Skip to content

Commit

Permalink
remove obsolete errors (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
swistakm authored Jun 3, 2024
1 parent 19a01f1 commit 674d7d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 76 deletions.
27 changes: 1 addition & 26 deletions blebox_uniapi/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ class Error(RuntimeError):


# Likely fixable/retriable network/busy errors


class TemporaryError(Error):
pass


class ConnectionError(TemporaryError):
class ConnectionError(Error):
pass


Expand All @@ -20,8 +14,6 @@ class TimeoutError(ConnectionError):


# Likely unfixable device errors (do not setup)


class ClientError(Error):
pass

Expand All @@ -35,8 +27,6 @@ class UnauthorizedRequest(ClientError):


# API errors


class BoxError(Error):
pass

Expand All @@ -49,15 +39,6 @@ class UnsupportedBoxVersion(BoxError):
pass


class UnsupportedAppVersion(BoxError):
pass


# TODO: not used yet
# class OutdatedBoxVersion(BoxError):
# pass



class BadFieldExceedsMax(BoxError):
def __init__(self, dev_name: str, field: str, value: int, max_value: int):
Expand Down Expand Up @@ -122,12 +103,6 @@ def __str__(self) -> str:
return f"{self._dev_name}.{self._field} is {self._value} which is not a rgbw string"


# API command errors


class BadOnValueError(BoxError):
pass


# misc errors

Expand Down
4 changes: 2 additions & 2 deletions blebox_uniapi/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ async def async_request(
except asyncio.TimeoutError as ex:
raise error.TimeoutError(
f"Failed to connect to {self.host}:{self.port} within {client_timeout}s: ({ex})"
) from None
) from ex

except aiohttp.ClientConnectionError as ex:
raise error.ConnectionError(
f"Failed to connect to {self.host}:{self.port}: {ex}"
) from None
) from ex

except aiohttp.ClientError as ex:
raise error.ClientError(f"API request {url} failed: {ex}") from ex
Expand Down
48 changes: 0 additions & 48 deletions tests/test_error.py

This file was deleted.

0 comments on commit 674d7d9

Please sign in to comment.