From 6fc89b88ef544925376e7649b535b3b9969cf809 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 17 Aug 2022 17:24:05 +0200 Subject: [PATCH] API: most App exceptions now return json error message --- app/api/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/__init__.py b/app/api/__init__.py index 0e3e72092..886c26f8c 100644 --- a/app/api/__init__.py +++ b/app/api/__init__.py @@ -4,11 +4,13 @@ from flask import Blueprint from flask import request from app.scodoc import sco_utils as scu +from app.scodoc.sco_exceptions import ScoException api_bp = Blueprint("api", __name__) api_web_bp = Blueprint("apiweb", __name__) +@api_bp.errorhandler(ScoException) @api_bp.errorhandler(404) def api_error_handler(e): "erreurs API => json"