release_device should not fail hard if stop_recording or close fail on ConnectionError

This commit is contained in:
Fabio Manganiello 2020-09-25 17:42:21 +02:00
parent 28409b8688
commit 258a9b57ce
1 changed files with 2 additions and 2 deletions

View File

@ -84,13 +84,13 @@ class CameraPiPlugin(CameraPlugin):
if device.object:
try:
device.object.stop_recording()
except picamera.PiCameraNotRecording:
except (ConnectionError, picamera.PiCameraNotRecording):
pass
if device.object and not device.object.closed:
try:
device.object.close()
except picamera.PiCameraClosed:
except (ConnectionError, picamera.PiCameraClosed):
pass
def capture_frame(self, camera: Camera, *args, **kwargs):