diff --git a/src/amcrest2mqtt/mixins/helpers.py b/src/amcrest2mqtt/mixins/helpers.py index cb9546f..5d64575 100644 --- a/src/amcrest2mqtt/mixins/helpers.py +++ b/src/amcrest2mqtt/mixins/helpers.py @@ -20,13 +20,11 @@ if TYPE_CHECKING: READY_FILE = os.getenv("READY_FILE", "/tmp/amcrest2mqtt.ready") - class ConfigError(ValueError): """Raised when the configuration file is invalid.""" pass - class HelpersMixin: async def build_device_states(self: Amcrest2Mqtt, device_id: str) -> bool: if self.is_rebooting(device_id): @@ -265,9 +263,15 @@ class HelpersMixin: try: file_path.write_bytes(recording.encode("latin-1")) + except PermissionError as err: + self.logger.error(f"permission error saving recording to {file_path}: {err!r}") + return None except IOError as err: self.logger.error(f"failed to save recording to {file_path}: {err!r}") return None + except Exception as err: + self.logger.error(f"failed to save recording to {file_path}: {err!r}") + return None self.upsert_state( device_id,