From 784bac925d70c86e22ed36b46f86657086f24f20 Mon Sep 17 00:00:00 2001 From: Shivam Gutgutia Date: Sun, 19 Nov 2023 01:08:25 +0530 Subject: [PATCH] Added error handler --- app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 00315c6..5433e67 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask +from flask import Flask, jsonify from flask_cors import CORS from dotenv import load_dotenv import os @@ -9,6 +9,10 @@ CORS(app) app.config['MAX_CONTENT_LENGTH'] = 1024*1024*1024 +@app.errorhandler(Exception) +def errorHandler(error): + return jsonify({"error":error}),500 + app.register_blueprint(router)