Skip to content

Commit

Permalink
fix: rename error
Browse files Browse the repository at this point in the history
  • Loading branch information
KatantDev committed Jan 29, 2024
1 parent 62c982c commit 1baab46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions centrifuge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .exceptions import (
CentrifugeError,
ClientDisconnectedError,
ClientTimeoutError,
OperationTimeoutError,
DuplicateSubscriptionError,
ReplyError,
SubscriptionUnsubscribedError,
Expand All @@ -49,7 +49,7 @@
"ClientState",
"SubscriptionState",
"CentrifugeError",
"ClientTimeoutError",
"OperationTimeoutError",
"ClientDisconnectedError",
"SubscriptionUnsubscribedError",
"DuplicateSubscriptionError",
Expand Down
16 changes: 8 additions & 8 deletions centrifuge/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from centrifuge.exceptions import (
CentrifugeError,
ClientDisconnectedError,
ClientTimeoutError,
OperationTimeoutError,
DuplicateSubscriptionError,
ReplyError,
SubscriptionUnsubscribedError,
Expand Down Expand Up @@ -318,7 +318,7 @@ async def _create_connection(self) -> bool:

try:
reply = await future
except ClientTimeoutError as e:
except OperationTimeoutError as e:
await self._close_transport_conn()
handler = self._events.on_error
await handler(ErrorContext(code=_code_number(_ErrorCode.TIMEOUT), error=e))
Expand Down Expand Up @@ -601,7 +601,7 @@ async def _subscribe(self, channel):
await self._send_commands([command])
try:
reply = await future
except ClientTimeoutError as e:
except OperationTimeoutError as e:
if sub.state != SubscriptionState.SUBSCRIBING:
return None
handler = sub._events.on_error
Expand Down Expand Up @@ -670,7 +670,7 @@ async def _unsubscribe(self, channel: str):

try:
await future
except ClientTimeoutError:
except OperationTimeoutError:
code = _ConnectingCode.UNSUBSCRIBE_ERROR
await self._disconnect(_code_number(code), _code_message(code), True)
return
Expand All @@ -683,7 +683,7 @@ def _register_future(self, cmd_id: int, timeout: float) -> asyncio.Future:

def cb():
if not future.done():
self._future_error(cmd_id, ClientTimeoutError())
self._future_error(cmd_id, OperationTimeoutError())

th = self._loop.call_later(timeout, cb)

Expand All @@ -710,7 +710,7 @@ async def _register_future_with_done(self, cmd_id: int, timeout: float):

def cb():
if not future.done():
self._future_error(cmd_id, ClientTimeoutError())
self._future_error(cmd_id, OperationTimeoutError())

th = self._loop.call_later(timeout, cb)

Expand Down Expand Up @@ -784,7 +784,7 @@ async def ready(self, timeout: Optional[float] = None) -> None:
timeout=timeout or self._timeout,
)
if not completed:
raise ClientTimeoutError("timeout waiting for connection to be ready")
raise OperationTimeoutError("timeout waiting for connection to be ready")

async def publish(
self,
Expand Down Expand Up @@ -1239,7 +1239,7 @@ async def ready(self, timeout: Optional[float] = None) -> None:
timeout=timeout or self._client._timeout,
)
if not completed:
raise ClientTimeoutError("timeout waiting for subscription to be ready")
raise OperationTimeoutError("timeout waiting for subscription to be ready")

async def history(
self,
Expand Down
4 changes: 2 additions & 2 deletions centrifuge/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class SubscriptionUnsubscribedError(CentrifugeError):
"""SubscriptionUnsubscribedError raised when an error subscribing on a channel occurred."""


class ClientTimeoutError(CentrifugeError):
"""ClientTimeoutError raised every time operation time out."""
class OperationTimeoutError(CentrifugeError):
"""OperationTimeoutError raised every time operation time out."""


class ReplyError(CentrifugeError):
Expand Down

0 comments on commit 1baab46

Please sign in to comment.