[fix] Correctly handle error 500 (#142)

* [fix] Correctly handle error 500
* [fix] Remove unwanted change in error_to_response
This commit is contained in:
Alexandre Aubin 2017-07-27 16:29:55 +02:00 committed by GitHub
parent e0a50487ec
commit 8960b1a610

View file

@ -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: