20 lines
552 B
Python
20 lines
552 B
Python
|
|
from enum import StrEnum
|
||
|
|
|
||
|
|
|
||
|
|
class FreshdeskErrorCode(StrEnum):
|
||
|
|
CONFIG_ERROR = "config_error"
|
||
|
|
AUTH_ERROR = "auth_error"
|
||
|
|
RATE_LIMITED = "rate_limited"
|
||
|
|
NOT_FOUND = "not_found"
|
||
|
|
NETWORK_ERROR = "network_error"
|
||
|
|
VALIDATION_ERROR = "validation_error"
|
||
|
|
UNKNOWN = "unknown"
|
||
|
|
|
||
|
|
|
||
|
|
class FreshdeskError(Exception):
|
||
|
|
def __init__(self, code: FreshdeskErrorCode, message: str, retry_after: float | None = None):
|
||
|
|
self.code = code
|
||
|
|
self.message = message
|
||
|
|
self.retry_after = retry_after
|
||
|
|
super().__init__(message)
|