Skip to content

Commit

Permalink
Fix uncaught Blink exceptions (#69770)
Browse files Browse the repository at this point in the history
  • Loading branch information
fronzbot authored Apr 27, 2022
1 parent 4a6ea5a commit 4317daa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion homeassistant/components/blink/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import logging

from requests.exceptions import ChunkedEncodingError

from homeassistant.components.camera import Camera
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -85,4 +87,11 @@ def camera_image(
self, width: int | None = None, height: int | None = None
) -> bytes | None:
"""Return a still image response from the camera."""
return self._camera.image_from_cache.content
try:
return self._camera.image_from_cache.content
except ChunkedEncodingError:
_LOGGER.debug("Could not retrieve image for %s", self._camera.name)
return None
except TypeError:
_LOGGER.debug("No cached image for %s", self._camera.name)
return None

0 comments on commit 4317daa

Please sign in to comment.