Skip to content

Commit

Permalink
Fix error on unsupported version logging
Browse files Browse the repository at this point in the history
  • Loading branch information
oven-lab committed Dec 16, 2023
1 parent fe494c1 commit 66c0466
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom_components/tuya_cloud_map_extractor/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def update(self):
_LOGGER.warning("Unable to parse map data")
_LOGGER.error(error)
self._status = CameraStatus.FAILURE
return

if map_data is not None:
_LOGGER.debug("Map is ok")
Expand Down Expand Up @@ -211,4 +212,4 @@ class CameraStatus(Enum):
INITIALIZING = "Initializing"
OK = "OK"
OFF = "OFF"
FAILURE = "Faliure"
FAILURE = "Failure"
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,6 @@ class DeviceIDError(Exception):

class PixelValueNotDefined(Exception):
pass

class NotSupportedError(Exception):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .v1 import decode_v1, to_array_v1, decode_path_v1
from .custom0 import decode_custom0, to_array_custom0, decode_path_custom0
from .tuya import get_download_link
from .const import NotSupportedError
from .common import decode_header

_LOGGER = logging.getLogger(__name__)
Expand All @@ -36,7 +37,7 @@ def parse_map(response: requests.models.Response):
elif header["version"] == [1]:
mapDataArr = decode_v1(data, header)
else:
raise RuntimeError
raise NotSupportedError("Map version " + str(header["version"]) +" is not supported.")

return header, mapDataArr

Expand Down

0 comments on commit 66c0466

Please sign in to comment.