Download behavior_backend/app/core/exceptions.py from urjob/test: direct link, hf CLI and curl.
- Browser
- Download file 1.85 kB
-
https://huggingface.co/spaces/urjob/test/resolve/main/behavior_backend/app/core/exceptions.py
- Command line
-
hf download hf://spaces/urjob/test/behavior_backend/app/core/exceptions.py
-
curl -L -o exceptions.py https://huggingface.co/spaces/urjob/test/resolve/main/behavior_backend/app/core/exceptions.py
1.85 kB
| from fastapi import HTTPException, status | |
| class VideoNotFoundError(HTTPException): | |
| """Exception raised when a video is not found.""" | |
| def __init__(self, video_id: str): | |
| super().__init__( | |
| status_code=status.HTTP_404_NOT_FOUND, | |
| detail=f"Video with ID {video_id} not found" | |
| ) | |
| class ResultNotFoundError(HTTPException): | |
| """Exception raised when a processing result is not found.""" | |
| def __init__(self, video_id: str): | |
| super().__init__( | |
| status_code=status.HTTP_404_NOT_FOUND, | |
| detail=f"Processing result for video with ID {video_id} not found" | |
| ) | |
| class VideoUploadError(HTTPException): | |
| """Exception raised when there is an error uploading a video.""" | |
| def __init__(self, detail: str = "Error uploading video"): | |
| super().__init__( | |
| status_code=status.HTTP_400_BAD_REQUEST, | |
| detail=detail | |
| ) | |
| class VideoProcessingError(HTTPException): | |
| """Exception raised when there is an error processing a video.""" | |
| def __init__(self, detail: str = "Error processing video"): | |
| super().__init__( | |
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | |
| detail=detail | |
| ) | |
| class InvalidParameterError(HTTPException): | |
| """Exception raised when a parameter is invalid.""" | |
| def __init__(self, parameter: str, detail: str = None): | |
| super().__init__( | |
| status_code=status.HTTP_400_BAD_REQUEST, | |
| detail=detail or f"Invalid parameter: {parameter}" | |
| ) | |
| class DatabaseError(HTTPException): | |
| """Exception raised when there is a database error.""" | |
| def __init__(self, detail: str = "Database error"): | |
| super().__init__( | |
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | |
| detail=detail | |
| ) |