Skip to content

Commit

Permalink
Add exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
smoothbear committed Mar 2, 2022
1 parent 5e9fccb commit efdfdb1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Server/app/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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):
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit efdfdb1

Please sign in to comment.