API: most App exceptions now return json error message

This commit is contained in:
Emmanuel Viennet 2022-08-17 17:24:05 +02:00
parent 504599ea66
commit 6fc89b88ef

View File

@ -4,11 +4,13 @@
from flask import Blueprint from flask import Blueprint
from flask import request from flask import request
from app.scodoc import sco_utils as scu from app.scodoc import sco_utils as scu
from app.scodoc.sco_exceptions import ScoException
api_bp = Blueprint("api", __name__) api_bp = Blueprint("api", __name__)
api_web_bp = Blueprint("apiweb", __name__) api_web_bp = Blueprint("apiweb", __name__)
@api_bp.errorhandler(ScoException)
@api_bp.errorhandler(404) @api_bp.errorhandler(404)
def api_error_handler(e): def api_error_handler(e):
"erreurs API => json" "erreurs API => json"