8000 Add link to error message if validation error occurs by fabaff · Pull Request #3530 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
Sep 28, 2016
Merged

Add link to error message if validation error occurs #3530

merged 1 commit into from
Sep 28, 2016

Conversation

fabaff
Copy link
Member
@fabaff fabaff commented Sep 26, 2016

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):

lock:
  - platform: mqtt
    name: "Front gate"
    state_NOTVALID_topic: "home/frontgate"
    command_topic: "home/frontgate/set"
    payload_lock: "LOCK"
    payload_unlock: "UNLOCK"

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@@ -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 '
Copy link
Member

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)
Copy link
Member

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))

Copy link
Member Author

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 '
Copy link
Member

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

Copy link
Member Author

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/

@balloob balloob merged commit a084232 into home-assistant:dev Sep 28, 2016
@fabaff fabaff deleted the link-docs branch September 28, 2016 07:09
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0