Buckets:
AnonymousSpottedToad/human_verified_bucket / codebase /python /nijaru_zenith /examples /task-api /app /exceptions.py
| """ | |
| Custom exceptions for API error handling. | |
| """ | |
| class APIException(Exception): | |
| """Base exception for all API errors.""" | |
| def __init__( | |
| self, message: str, status_code: int = 400, details: dict | None = None | |
| ): | |
| self.message = message | |
| self.status_code = status_code | |
| self.details = details or {} | |
| super().__init__(message) | |
| class NotFoundError(APIException): | |
| """Resource not found.""" | |
| def __init__(self, message: str = "Resource not found"): | |
| super().__init__(message, status_code=404) | |
| class ConflictError(APIException): | |
| """Resource conflict (duplicate, etc).""" | |
| def __init__(self, message: str = "Resource conflict"): | |
| super().__init__(message, status_code=409) | |
| class ValidationError(APIException): | |
| """Validation failed.""" | |
| def __init__(self, message: str = "Validation failed", details: dict | None = None): | |
| super().__init__(message, status_code=422, details=details) | |
| class PermissionError(APIException): | |
| """Permission denied.""" | |
| def __init__(self, message: str = "Permission denied"): | |
| super().__init__(message, status_code=403) | |
| class AuthenticationError(APIException): | |
| """Authentication failed.""" | |
| def __init__(self, message: str = "Authentication required"): | |
| super().__init__(message, status_code=401) | |
Xet Storage Details
- Size:
- 1.35 kB
- Xet hash:
- f50b79490884df4d627b63588175afddbda0aaa330ea4293379836fbb81fa166
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.