mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-18 14:24: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._exceptions import IncompleteCredentialError
|
||||
|
||||
from bfxapi.rest import BfxRestInterface
|
||||
from bfxapi.websocket import BfxWebSocketClient
|
||||
from bfxapi.exceptions import IncompleteCredentialError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
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 *
|
||||
from bfxapi.exceptions import BfxBaseException
|
||||
|
||||
class ResourceNotFound(BfxBaseException):
|
||||
"""
|
||||
This error indicates a failed HTTP request to a non-existent resource.
|
||||
"""
|
||||
class NotFoundError(BfxBaseException):
|
||||
pass
|
||||
|
||||
class RequestParametersError(BfxBaseException):
|
||||
"""
|
||||
This error indicates that there are some invalid parameters sent along with an HTTP request.
|
||||
"""
|
||||
pass
|
||||
|
||||
class UnknownGenericError(BfxBaseException):
|
||||
"""
|
||||
This error indicates an undefined problem processing an HTTP request sent to the APIs.
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -6,7 +6,9 @@ from http import HTTPStatus
|
||||
|
||||
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_decoder import JSONDecoder
|
||||
|
||||
@@ -55,7 +57,7 @@ class Middleware:
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
@@ -88,7 +90,7 @@ class Middleware:
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -24,8 +24,10 @@ from bfxapi.websocket._connection import Connection
|
||||
from bfxapi.websocket._handlers import AuthEventsHandler
|
||||
from bfxapi.websocket._event_emitter import BfxEventEmitter
|
||||
|
||||
from bfxapi.exceptions import \
|
||||
InvalidCredentialError
|
||||
|
||||
from bfxapi.websocket.exceptions import \
|
||||
InvalidCredentialError, \
|
||||
ReconnectionTimeoutError, \
|
||||
VersionMismatchError, \
|
||||
UnknownChannelError, \
|
||||
|
||||
@@ -1,47 +1,25 @@
|
||||
# pylint: disable-next=wildcard-import,unused-wildcard-import
|
||||
from bfxapi._exceptions import *
|
||||
from bfxapi.exceptions import BfxBaseException
|
||||
|
||||
class ConnectionNotOpen(BfxBaseException):
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
pass
|
||||
|
||||
class ActionRequiresAuthentication(BfxBaseException):
|
||||
"""
|
||||
This error indicates an attempt to access a protected resource without logging in first.
|
||||
"""
|
||||
pass
|
||||
|
||||
class UnknownChannelError(BfxBaseException):
|
||||
"""
|
||||
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 ReconnectionTimeoutError(BfxBaseException):
|
||||
pass
|
||||
|
||||
class VersionMismatchError(BfxBaseException):
|
||||
"""
|
||||
This error indicates a mismatch between the client version and the server WSS version.
|
||||
"""
|
||||
pass
|
||||
|
||||
class SubIdError(BfxBaseException):
|
||||
"""
|
||||
Thrown when a user attempts to open more than one subscription using the same sub_id.
|
||||
"""
|
||||
pass
|
||||
|
||||
class UnknownChannelError(BfxBaseException):
|
||||
pass
|
||||
|
||||
class UnknownEventError(BfxBaseException):
|
||||
pass
|
||||
|
||||
class UnknownSubscriptionError(BfxBaseException):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user