From 01dcf5000e0e85ad62cb3bc80deb1ab2b6d5b444 Mon Sep 17 00:00:00 2001 From: JavaScriptDude Date: Tue, 19 Jul 2022 12:11:33 -0400 Subject: [PATCH] Patch To Implement Suggestion 458 Allow error handlers to have full control of response --- flask_restx/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flask_restx/api.py b/flask_restx/api.py index f89deeb8..eba633c4 100644 --- a/flask_restx/api.py +++ b/flask_restx/api.py @@ -706,6 +706,8 @@ def handle_error(self, e): for typecheck, handler in six.iteritems(self._own_and_child_error_handlers): if isinstance(e, typecheck): result = handler(e) + if not result is None and issubclass(result.__class__, BaseResponse): + return result default_data, code, headers = unpack( result, HTTPStatus.INTERNAL_SERVER_ERROR )