first commit

This commit is contained in:
Azeez Muibi
2025-04-10 19:32:50 +01:00
commit 075f953dbc
89 changed files with 3641 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
from .handlers import register_error_handlers
+24
View File
@@ -0,0 +1,24 @@
from werkzeug.exceptions import HTTPException
from flask import jsonify
from app.api.helpers.response_helper import ResponseHelper
def register_error_handlers(app):
@app.errorhandler(HTTPException)
def handle_http_exception(e):
return jsonify({'error': e.description}), e.code
@app.errorhandler(405)
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
@app.errorhandler(404)
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
@app.errorhandler(400)
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
@app.errorhandler(415)
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415