mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 23:04:21 +01:00
Remove useless and redundant docstrings from custom exceptions.
This commit is contained in:
@@ -3,10 +3,9 @@ from typing import \
|
|||||||
|
|
||||||
from bfxapi._utils.logging import ColorLogger
|
from bfxapi._utils.logging import ColorLogger
|
||||||
|
|
||||||
from bfxapi._exceptions import IncompleteCredentialError
|
|
||||||
|
|
||||||
from bfxapi.rest import BfxRestInterface
|
from bfxapi.rest import BfxRestInterface
|
||||||
from bfxapi.websocket import BfxWebSocketClient
|
from bfxapi.websocket import BfxWebSocketClient
|
||||||
|
from bfxapi.exceptions import IncompleteCredentialError
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bfxapi.websocket._client.bfx_websocket_client import \
|
from bfxapi.websocket._client.bfx_websocket_client import \
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
class BfxBaseException(Exception):
|
|
||||||
"""
|
|
||||||
Base class for every custom exception in bfxapi/rest/exceptions.py and bfxapi/websocket/exceptions.py.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class IncompleteCredentialError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
This error indicates an incomplete credential object (missing api-key or api-secret).
|
|
||||||
"""
|
|
||||||
|
|
||||||
class InvalidCredentialError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
This error indicates that the user has provided incorrect credentials (API-KEY and API-SECRET) for authentication.
|
|
||||||
"""
|
|
||||||
10
bfxapi/exceptions.py
Normal file
10
bfxapi/exceptions.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class BfxBaseException(Exception):
|
||||||
|
"""
|
||||||
|
Base class for every custom exception thrown by bitfinex-api-py.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class IncompleteCredentialError(BfxBaseException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class InvalidCredentialError(BfxBaseException):
|
||||||
|
pass
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
# pylint: disable-next=wildcard-import,unused-wildcard-import
|
from bfxapi.exceptions import BfxBaseException
|
||||||
from bfxapi._exceptions import *
|
|
||||||
|
|
||||||
class ResourceNotFound(BfxBaseException):
|
class NotFoundError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates a failed HTTP request to a non-existent resource.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class RequestParametersError(BfxBaseException):
|
class RequestParametersError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates that there are some invalid parameters sent along with an HTTP request.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class UnknownGenericError(BfxBaseException):
|
class UnknownGenericError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates an undefined problem processing an HTTP request sent to the APIs.
|
|
||||||
"""
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from http import HTTPStatus
|
|||||||
|
|
||||||
import time, hmac, hashlib, json, requests
|
import time, hmac, hashlib, json, requests
|
||||||
|
|
||||||
from ..exceptions import ResourceNotFound, RequestParametersError, InvalidCredentialError, UnknownGenericError
|
from ..exceptions import NotFoundError, RequestParametersError, UnknownGenericError
|
||||||
|
|
||||||
|
from ...exceptions import InvalidCredentialError
|
||||||
from ..._utils.json_encoder import JSONEncoder
|
from ..._utils.json_encoder import JSONEncoder
|
||||||
from ..._utils.json_decoder import JSONDecoder
|
from ..._utils.json_decoder import JSONDecoder
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ class Middleware:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||||
raise ResourceNotFound(f"No resources found at endpoint <{endpoint}>.")
|
raise NotFoundError(f"No resources found at endpoint <{endpoint}>.")
|
||||||
|
|
||||||
data = response.json(cls=JSONDecoder)
|
data = response.json(cls=JSONDecoder)
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ class Middleware:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||||
raise ResourceNotFound(f"No resources found at endpoint <{endpoint}>.")
|
raise NotFoundError(f"No resources found at endpoint <{endpoint}>.")
|
||||||
|
|
||||||
data = response.json(cls=JSONDecoder)
|
data = response.json(cls=JSONDecoder)
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ from bfxapi.websocket._connection import Connection
|
|||||||
from bfxapi.websocket._handlers import AuthEventsHandler
|
from bfxapi.websocket._handlers import AuthEventsHandler
|
||||||
from bfxapi.websocket._event_emitter import BfxEventEmitter
|
from bfxapi.websocket._event_emitter import BfxEventEmitter
|
||||||
|
|
||||||
|
from bfxapi.exceptions import \
|
||||||
|
InvalidCredentialError
|
||||||
|
|
||||||
from bfxapi.websocket.exceptions import \
|
from bfxapi.websocket.exceptions import \
|
||||||
InvalidCredentialError, \
|
|
||||||
ReconnectionTimeoutError, \
|
ReconnectionTimeoutError, \
|
||||||
VersionMismatchError, \
|
VersionMismatchError, \
|
||||||
UnknownChannelError, \
|
UnknownChannelError, \
|
||||||
|
|||||||
@@ -1,47 +1,25 @@
|
|||||||
# pylint: disable-next=wildcard-import,unused-wildcard-import
|
from bfxapi.exceptions import BfxBaseException
|
||||||
from bfxapi._exceptions import *
|
|
||||||
|
|
||||||
class ConnectionNotOpen(BfxBaseException):
|
class ConnectionNotOpen(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates an attempt to communicate via websocket before starting the connection with the servers.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class FullBucketError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
Thrown when a user attempts a subscription but all buckets are full.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class ReconnectionTimeoutError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
This error indicates that the connection has been offline for too long without being able to reconnect.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class ActionRequiresAuthentication(BfxBaseException):
|
class ActionRequiresAuthentication(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates an attempt to access a protected resource without logging in first.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class UnknownChannelError(BfxBaseException):
|
class ReconnectionTimeoutError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
Thrown when a user attempts to subscribe to an unknown channel.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class UnknownSubscriptionError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
Thrown when a user attempts to reference an unknown subscription.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class UnknownEventError(BfxBaseException):
|
|
||||||
"""
|
|
||||||
Thrown when a user attempts to add a listener for an unknown event.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class VersionMismatchError(BfxBaseException):
|
class VersionMismatchError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
This error indicates a mismatch between the client version and the server WSS version.
|
|
||||||
"""
|
|
||||||
|
|
||||||
class SubIdError(BfxBaseException):
|
class SubIdError(BfxBaseException):
|
||||||
"""
|
pass
|
||||||
Thrown when a user attempts to open more than one subscription using the same sub_id.
|
|
||||||
"""
|
class UnknownChannelError(BfxBaseException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class UnknownEventError(BfxBaseException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class UnknownSubscriptionError(BfxBaseException):
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user