From 8960b1a6104ee3e6076e247aadd27ee0291cf2d6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 27 Jul 2017 16:29:55 +0200 Subject: [PATCH] [fix] Correctly handle error 500 (#142) * [fix] Correctly handle error 500 * [fix] Remove unwanted change in error_to_response --- moulinette/interfaces/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index 5d96af98..4901cafd 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -387,6 +387,15 @@ class _ActionsMapPlugin(object): ret = self.actionsmap.process(arguments, timeout=30, route=_route) except MoulinetteError as e: raise error_to_response(e) + except Exception as e: + if isinstance(e, HTTPResponse): + raise e + import traceback + tb = traceback.format_exc() + logs = { "route": _route, + "arguments": arguments, + "traceback": tb } + return HTTPErrorResponse(json_encode(logs)) else: return format_for_response(ret) finally: