Fix raising objects on proxy camera component

This commit is contained in:
Pascal Vizeli 2018-11-22 15:06:31 +01:00 committed by GitHub
parent b246fc977e
commit 13144af65e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,16 +71,16 @@ def _precheck_image(image, opts):
import io import io
if not opts: if not opts:
raise ValueError raise ValueError()
try: try:
img = Image.open(io.BytesIO(image)) img = Image.open(io.BytesIO(image))
except IOError: except IOError:
_LOGGER.warning("Failed to open image") _LOGGER.warning("Failed to open image")
raise ValueError raise ValueError()
imgfmt = str(img.format) imgfmt = str(img.format)
if imgfmt not in ('PNG', 'JPEG'): if imgfmt not in ('PNG', 'JPEG'):
_LOGGER.warning("Image is of unsupported type: %s", imgfmt) _LOGGER.warning("Image is of unsupported type: %s", imgfmt)
raise ValueError raise ValueError()
return img return img
@ -267,7 +267,7 @@ class ProxyCamera(Camera):
if not image: if not image:
return None return None
except HomeAssistantError: except HomeAssistantError:
raise asyncio.CancelledError raise asyncio.CancelledError()
if self._mode == MODE_RESIZE: if self._mode == MODE_RESIZE:
job = _resize_image job = _resize_image