Spaces:
Sleeping
Sleeping
Download src/api/errors.py from Darshankumarr03/vibesense: direct link, hf CLI and curl.
- Browser
- Download file 583 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/vibesense/resolve/main/src/api/errors.py
- Command line
-
hf download hf://spaces/Darshankumarr03/vibesense/src/api/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/Darshankumarr03/vibesense/resolve/main/src/api/errors.py
583 Bytes
| from flask import jsonify | |
| from src.core.exceptions import AppError | |
| def register_error_handlers(app): | |
| def handle_app_error(error): | |
| response = jsonify(error.to_dict()) | |
| response.status_code = error.status_code | |
| return response | |
| def resource_not_found(e): | |
| return jsonify({'error': 'Resource not found', 'status': 404}), 404 | |
| def internal_server_error(e): | |
| return jsonify({'error': 'An unexpected internal server error occurred', 'status': 500}), 500 | |