feat
This commit is contained in:
14
py-client/sdk/errors.py
Normal file
14
py-client/sdk/errors.py
Normal file
@@ -0,0 +1,14 @@
|
||||
class APIError(RuntimeError):
|
||||
def __init__(self, status_code: int, message: str = "") -> None:
|
||||
self.status_code = status_code
|
||||
self.message = message
|
||||
text = f"qmt api: http {status_code}"
|
||||
super().__init__(f"{text}: {message}" if message else text)
|
||||
|
||||
@property
|
||||
def unauthorized(self) -> bool:
|
||||
return self.status_code == 401
|
||||
|
||||
|
||||
class BusinessError(RuntimeError):
|
||||
pass
|
||||
Reference in New Issue
Block a user