-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Add link to error message if validation err 8000 or occurs #3530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -408,6 +409,9 @@ def log_exception(ex, domain, config): | |||
message += " (See {}:{})".format(config.__config_file__, | |||
config.__line__ or '?') | |||
|
|||
message += '. Please check the docs at ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not append this to the message when domain == 'homeassistant'
@@ -408,6 +409,9 @@ def log_exception(ex, domain, config): | |||
message += " (See {}:{})".format(config.__config_file__, | |||
config.__line__ or '?') | |||
|
|||
message += '. Please check the docs at ' | |||
message += 'https://home-assistant.io/components/{}/ '.format(domain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make it 1 string concatenation instead of 2 (slightly better performance). Python has implicit string concatenation within parentheses:
if domain != 'homeassistant':
message += ('. Please check the docs at '
'https://home-assistant.io/components/{}/ '.format(domain))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
@@ -408,6 +409,10 @@ def log_exception(ex, domain, config): | |||
message += " (See {}:{})".format(config.__config_file__, | |||
config.__line__ or '?') | |||
|
|||
if domain != 'homeassistant': | |||
message += ('. Please check the docs at ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will an extra period if extra keys not allowed
is NOT in ex.error_message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Le 8000 arn more.
I reviewed the adding of periods. The output will look like the samples below.
16-09-28 00:29:38 ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [homeassistant]: expected int for dictionary value @ data['elevation']. Got 'abcd'. (See /home/fab/.homeassistant/configuration.yaml:3)
16-09-28 00:30:24 ERROR (Thread-1) [homeassistant.bootstrap] Invalid config for [http]: [api_password1] is an invalid option for [http]. Check: http->http->api_password1. Please check the docs at https://home-assistant.io/components/http/
16-09-28 00:31:07 ERROR (Thread-1) [homeassistant.bootstrap] Invalid config for [zone]: expected float for dictionary value @ data['radius']. Got {}. Please check the docs at https://home-assistant.io/components/zone/
16-09-28 00:32:40 ERROR (Thread-1) [homeassistant.bootstrap] Invalid config for [lock.mqtt]: [name1] is an invalid option for [lock.mqtt]. Check: lock.mqtt->name1. Please check the docs at https://home-assistant.io/components/lock.mqtt/
Description:
Add the link to the documentation to the error message.
Related issue (if applicable): fixes https://www.pivotaltracker.com/story/show/130296315
Example entry for
configuration.yaml
(if applicable):Checklist:
If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass