-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
Fix uncaught Blink exceptions #69770
Conversation
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.
LGTM
return self._camera.image_from_cache.content | ||
except ChunkedEncodingError: | ||
_LOGGER.debug("Could not retrieve image for %s", self._camera.name) | ||
return b"" |
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.
None
is a valid return type, shouldn't it return that instead?
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.
From my perspective I don't really know if it matters if it's None
or an empty byte string. But if, from a code quality standpoint, you'd prefer it to be None
let me know and I'll make the change.
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.
I think None
makes more sense to be honest
return self._camera.image_from_cache.content | ||
except ChunkedEncodingError: | ||
_LOGGER.debug("Could not retrieve image for %s", self._camera.name) | ||
return b"" |
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.
return b"" | |
return None |
return b"" | ||
except TypeError: | ||
_LOGGER.debug("No cached image for %s", self._camera.name) | ||
return b"" |
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.
return b"" | |
return None |
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.
Please see comment above
https://github.com/home-assistant/core/pull/69770/files#r852657146
I think this is good to merge once the proposed change text is updated 👍 |
I didn't want to hold this up since beta is tomorrow so I went ahead and tweaked the text above so we can get this merged. |
Proposed change
As reported in fronzbot/blinkpy#567 there are uncaught exceptions in the home-assistant integration when retrieving a thumbnail. The result of this is due to closed connections/timeouts, so a simply try/except was added to return None, log, and filter the exception.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: