Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove obsolete errors #174

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions blebox_uniapi/error.py
Original file line number Diff line number Diff line change
@@ -5,13 +5,7 @@ class Error(RuntimeError):


# Likely fixable/retriable network/busy errors


class TemporaryError(Error):
pass


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


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


# Likely unfixable device errors (do not setup)


class ClientError(Error):
pass

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


# API errors


class BoxError(Error):
pass

@@ -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):
@@ -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

4 changes: 2 additions & 2 deletions blebox_uniapi/session.py
Original file line number Diff line number Diff line change
@@ -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
48 changes: 0 additions & 48 deletions tests/test_error.py

This file was deleted.