From efdfdb1387c7687ad3e4bb2c19861c659ff3c12f Mon Sep 17 00:00:00 2001 From: KIM JUNG BIN Date: Wed, 2 Mar 2022 15:19:50 +0900 Subject: [PATCH] Add exception handler --- Server/app/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/app/__init__.py b/Server/app/__init__.py index 1033710..8ebf340 100644 --- a/Server/app/__init__.py +++ b/Server/app/__init__.py @@ -1,7 +1,7 @@ -from werkzeug.exceptions import HTTPException from flask import Flask, jsonify from jwt.exceptions import PyJWTError from flask_jwt_extended.exceptions import JWTExtendedException +from app.exception import DMSException from config import config @@ -23,7 +23,7 @@ def register_hook(flask_app: Flask): from app.hook.exception_handler import http_exception_handler flask_app.register_error_handler(JWTExtendedException, jwt_handle) flask_app.register_error_handler(PyJWTError, jwt_handle) - flask_app.register_error_handler(HTTPException, http_exception_handler) + flask_app.register_error_handler(DMSException, http_exception_handler) def register_blueprint(flask_app: Flask): @@ -58,7 +58,7 @@ def create_app(config_name: str) -> Flask: return flask_app -def wrong_token_handler(wrong_token: str, _): +def wrong_token_handler(wrong_token: str): return jsonify({ 'status': 403, 'sub_status': 42,