[docs]class BSXRequestException(Exception):
"""Exception class for BSX Request"""
_code: int
_message: str
_detail: str
[docs] def __init__(self, code: int, message: str, detail: str):
super().__init__(f'Request failed with code: {code}, message: {message}, detail: {detail}')
"""Return error code return by the request"""
[docs] def get_code(self) -> int:
return self._code
"""Return error message return by the request"""
[docs] def get_message(self) -> str:
return self._message
"""Return error detail return by the request in raw text format"""
[docs] def get_detail(self) -> str:
return self._detail
[docs]class UnknownException(BSXRequestException):
_response_body: str
[docs] def __init__(self, response_body: str):
super().__init__(500, "Unknown error", detail=f"Response: {response_body}")
self._response_body = response_body
[docs]class UnauthenticatedException(BSXRequestException):
[docs] def __init__(self):
super().__init__(code=16, message="Unauthenticated", detail="")
[docs]class NotSupportOperationException(Exception):
pass
[docs]class WalletPrivateNotProvidedException(Exception):
pass