Update: Handle Exception
This commit is contained in:
parent
a9324fb35a
commit
fafe6fafd7
1 changed files with 6 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from flask import request, Blueprint
|
||||
from flask_cors import CORS
|
||||
from werkzeug.exceptions import HTTPException
|
||||
from .responses import send_message, send_error
|
||||
from .api_functions import db_login, db_register, db_user_update, db_create_log, db_user_delete, db_admin_update_user, \
|
||||
db_users
|
||||
|
|
@ -9,6 +10,11 @@ bp = Blueprint('myapp', __name__)
|
|||
CORS(bp, supports_credentials=True, origins=['http://127.0.0.1:4200', 'http://localhost:4200'])
|
||||
|
||||
|
||||
@bp.app_errorhandler(HTTPException)
|
||||
def handle_exception(e):
|
||||
return send_error(e.code, e.name)
|
||||
|
||||
|
||||
# Login
|
||||
@bp.route('/api/login', methods=['POST'])
|
||||
def login():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue