Rename log message / handle cancellederror on image proxy (#5331)

This commit is contained in:
Pascal Vizeli 2017-01-15 17:35:58 +01:00 committed by Paulus Schoutsen
parent 85a84549eb
commit c458ee29f2
4 changed files with 12 additions and 8 deletions

View file

@ -175,7 +175,7 @@ class Camera(Entity):
yield from asyncio.sleep(.5)
except asyncio.CancelledError:
_LOGGER.debug("Close stream by browser.")
_LOGGER.debug("Close stream by frontend.")
response = None
finally:
@ -249,12 +249,16 @@ class CameraImageView(CameraView):
@asyncio.coroutine
def handle(self, request, camera):
"""Serve camera image."""
image = yield from camera.async_camera_image()
try:
image = yield from camera.async_camera_image()
if image is None:
return web.Response(status=500)
if image is None:
return web.Response(status=500)
return web.Response(body=image)
return web.Response(body=image)
except asyncio.CancelledError:
_LOGGER.debug("Close stream by frontend.")
class CameraMjpegStream(CameraView):