-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from flask import jsonify | ||
|
||
def handle_bad_request(error): | ||
return jsonify({'error': 'Bad Request', 'message': str(error)}), 400 | ||
|
||
def handle_unauthorized(error): | ||
return jsonify({'error': 'Unauthorized', 'message': str(error)}), 401 | ||
|
||
def handle_forbidden(error): | ||
return jsonify({'error': 'Forbidden', 'message': str(error)}), 403 | ||
|
||
def handle_not_found(error): | ||
return jsonify({'error': 'Not Found', 'message': str(error)}), 404 | ||
|
||
def handle_method_not_allowed(error): | ||
return jsonify({'error': 'Method Not Allowed', 'message': str(error)}), 405 | ||
|
||
def handle_internal_server_error(error): | ||
return jsonify({'error': 'Internal Server Error', 'message': str(error)}), 500 | ||
|
||
def handle_service_unavailable(error): | ||
return jsonify({'error': 'Service Unavailable', 'message': str(error)}), 503 |