[add]: Bank to simbrella calls

This commit is contained in:
VivianDee
2025-03-25 06:39:27 +01:00
parent 0bb36be246
commit f4c2e25025
79 changed files with 1428 additions and 938 deletions
+1 -1
View File
@@ -1 +1 @@
from .handlers import method_not_allowed, unsupported_media_type
from .handlers import register_error_handlers
+19 -9
View File
@@ -1,14 +1,24 @@
from werkzeug.exceptions import HTTPException
from flask import jsonify
from app.helpers.response_helper import ResponseHelper
from app.api.helpers.response_helper import ResponseHelper
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
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
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
@app.errorhandler(404)
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
@app.errorhandler(400)
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415
@app.errorhandler(415)
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415