27 lines
594 B
Python
27 lines
594 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
|
||
|
|
class ZulipError(Exception):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
class ZulipAPIError(ZulipError):
|
||
|
|
def __init__(self, status_code: int, response_data: dict):
|
||
|
|
self.status_code = status_code
|
||
|
|
self.response_data = response_data
|
||
|
|
self.code = response_data.get("code", "")
|
||
|
|
self.msg = response_data.get("msg", "")
|
||
|
|
super().__init__(f"Zulip API error ({status_code}): {self.code} - {self.msg}")
|
||
|
|
|
||
|
|
|
||
|
|
class ZulipAuthError(ZulipError):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
class ZulipQueueExpiredError(ZulipAPIError):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
class ZulipRateLimitError(ZulipAPIError):
|
||
|
|
pass
|