Add ZeroConnectionsError in bfxapi.websocket.exceptions. Add log if connections = 0 in BfxWebsocketClient::start. Add raise ZeroConnectionError in BfxWebsocketClient::subscribe if connections equals 0.

This commit is contained in:
Davide Casale
2023-03-14 19:03:05 +01:00
parent 98c3e4f352
commit 249f19fe41
3 changed files with 27 additions and 14 deletions

View File

@@ -5,9 +5,11 @@ __all__ = [
"ConnectionNotOpen",
"TooManySubscriptions",
"ZeroConnectionsError",
"WebsocketAuthenticationRequired",
"InvalidAuthenticationCredentials",
"EventNotSupported",
"HandlerNotFound",
"OutdatedClientVersion"
]
@@ -26,29 +28,33 @@ class TooManySubscriptions(BfxWebsocketException):
This error indicates a subscription attempt after reaching the limit of simultaneous connections.
"""
class ZeroConnectionsError(BfxWebsocketException):
"""
This error indicates an attempt to subscribe to a public channel while the number of connections is 0.
"""
class WebsocketAuthenticationRequired(BfxWebsocketException):
"""
This error indicates an attempt to access a protected resource without logging in first.
"""
class InvalidAuthenticationCredentials(BfxWebsocketException):
"""
This error indicates that the user has provided incorrect credentials (API-KEY and API-SECRET) for authentication.
"""
class EventNotSupported(BfxWebsocketException):
"""
This error indicates a failed attempt to subscribe to an event not supported by the BfxWebsocketClient.
"""
class OutdatedClientVersion(BfxWebsocketException):
"""
This error indicates a mismatch between the client version and the server WSS version.
"""
class InvalidAuthenticationCredentials(BfxWebsocketException):
"""
This error indicates that the user has provided incorrect credentials (API-KEY and API-SECRET) for authentication.
"""
class HandlerNotFound(BfxWebsocketException):
"""
This error indicates that a handler was not found for an incoming message.
"""
class OutdatedClientVersion(BfxWebsocketException):
"""
This error indicates a mismatch between the client version and the server WSS version.
"""