15 lines
419 B
Python
15 lines
419 B
Python
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
|