mirror of
https://github.com/mindverse/Second-Me.git
synced 2026-07-21 23:23:26 +00:00
22 lines
484 B
Python
22 lines
484 B
Python
from typing import Any
|
|
|
|
|
|
class ErrorCodes:
|
|
SUCCESS = 0
|
|
BAD_REQUEST = 400
|
|
UNAUTHORIZED = 401
|
|
FORBIDDEN = 403
|
|
NOT_FOUND = 404
|
|
INTERNAL_ERROR = 500
|
|
CONFIGURATION_ERROR = 501
|
|
PATH_NOT_FOUND = 10404
|
|
|
|
|
|
class APIError(Exception):
|
|
def __init__(
|
|
self, message: str, code: int = ErrorCodes.INTERNAL_ERROR, data: Any = None
|
|
):
|
|
self.message = message
|
|
self.code = code
|
|
self.data = data
|
|
super().__init__(self.message)
|