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