[add]: Error handling

This commit is contained in:
VivianDee
2025-03-21 11:18:03 +01:00
parent a73b05054f
commit f2c688c3e8
7 changed files with 59 additions and 2 deletions
+7
View File
@@ -2,6 +2,7 @@ from flask import Flask
from flask_cors import CORS
from app.config import Config
from app.routes import api
from app.errors import bad_request, method_not_allowed, not_found
def create_app():
""" Factory function to create a Flask app instance """
@@ -16,4 +17,10 @@ def create_app():
# Register blueprints
app.register_blueprint(api)
# Error Handlers
app.register_error_handler(400, bad_request)
app.register_error_handler(404, not_found)
app.register_error_handler(405, method_not_allowed)
return app