8000 Streamline SimpliSafe errors by bachya · Pull Request #43117 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Streamline SimpliSafe errors #43117 < 10000 /h1>
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 2 commits into from
Nov 13, 2020
Merged

Streamline SimpliSafe errors #43117

merged 2 commits into from
Nov 13, 2020

Conversation

bachya
Copy link
Contributor
@bachya bachya commented Nov 11, 2020

Proposed change

With the current SimpliSafe exception handling logic, logging seems too messy. For instance, an HTTP 502 from SimpliSafe's cloud yields three separate log lines:

2020-11-11 23:07:23 ERROR (MainThread) [homeassistant.components.simplisafe] SimpliSafe error while updating: There was an error while requesting /ss3/subscriptions/XXXXXX/settings/normal: 502, message='Bad Gateway', url=URL('https://api.simplisafe.com/v1/ss3/subscriptions/XXXXXX/settings/normal?forceUpdate=true')
2020-11-11 23:07:23 ERROR (MainThread) [homeassistant.components.simplisafe] Error fetching user@email.com data:
2020-11-11 23:07:23 ERROR (MainThread) [homeassistant.components.simplisafe] Unknown error while updating: 'str' object has no attribute 'get'

Line 1 is a valid, well-represented error.

Line 2 is the output from the DataUpdate Coordinator, which is unhelpful.

Line 3 is...who knows.

In my opinion, this is a case where raise from hurts the readability of the final logs. So, this PR does two things:

  1. Modifies the current exception handling so lines 1 and 2 above are combined into a single log message
  2. Removes some too-broad error handling that creates line 3 (with the expectation that seeing the actual error will allow for future improvement).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: N/A
  • This PR is related to issue: N/A
  • Link to documentation pull request: N/A

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@bachya bachya added this to the 0.118.0 milestone Nov 11, 2020
@bachya bachya self-assigned this Nov 11, 2020
@balloob balloob merged commit ad7f144 into home-assistant:dev Nov 13, 2020
balloob pushed a commit that referenced this pull request Nov 13, 2020
KJonline pushed a commit to Pyhass/core that referenced this pull request Nov 13, 2020
* 'dev' of https://github.com/home-assistant/core: (32 commits)
  Disable parsing scientific/complex number notation in template type (home-assistant#43170)
  Remove relative time sensor from cert_expiry (home-assistant#42338)
  Further improve MFI tests (home-assistant#43167)
  Update translations
  Guard against empty ssdp locations (home-assistant#43156)
  Fix playing of Spotify URIs on Sonos (home-assistant#43154)
  Add missing 'hassio' translation string (home-assistant#43127)
  Streamline SimpliSafe errors (home-assistant#43117)
  Update xknx to 0.15.3 (home-assistant#42026)
  Fix beat calculation (home-assistant#43142)
  Mock time_date sensor tests (home-assistant#43141)
  [ci skip] Translation update
  Fix bug preventing Notion entities from updating their bridge (home-assistant#43122)
  Bump hass-nabucasa to 0.37.2 (home-assistant#43146)
  Shelly: minor improvements (home-assistant#43138)
  Add support for learning RF commands with Broadlink remotes (home-assistant#39671)
  Fix incorrect Notion battery state calculation (home-assistant#43108)
  Bump hatasmota to 0.0.30 (home-assistant#43140)
  Add VSCode debug launch conf (home-assistant#43130)
  Revert "shelly_naming" rebase errors (home-assistant#43134)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2020
@MartinHjelmare
Copy link
Member

Using raise... from or not doesn't impact the error log. It impacts the stack trace. I don't understand the reasoning around this in the description.

@bachya bachya deleted the ss-errors branch November 17, 2020 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0