Commit e3f02195 authored by Fabio Manganiello's avatar Fabio Manganiello
Browse files

Errors should be caught also before a request action is executed (prevents...

Errors should be caught also before a request action is executed (prevents HTTP timeouts when the error is on e.g. get_plugin() level)
parent fa17011b
Pipeline #63 canceled with stages
......@@ -207,21 +207,29 @@ class Request(Message):
def _thread_func(_n_tries, errors=None):
response = None
if self.action.startswith('procedure.'):
context['n_tries'] = _n_tries
response = self._execute_procedure(**context)
if response is not None:
try:
if self.action.startswith('procedure.'):
context['n_tries'] = _n_tries
response = self._execute_procedure(**context)
if response is not None:
self._send_response(response)
return response
# utils.get_context is a special action that simply returns the current context
elif self.action == 'utils.get_context':
response = Response(output=context)
self._send_response(response)
return response
# utils.get_context is a special action that simply returns the current context
elif self.action == 'utils.get_context':
response = Response(output=context)
return response
else:
action = self.expand_value_from_context(self.action, **context)
(module_name, method_name) = get_module_and_method_from_action(action)
plugin = get_plugin(module_name)
except Exception as e:
logger.exception(e)
msg = 'Uncaught pre-processing exception from action [{}]: {}'.format(self.action, str(e))
logger.warning(msg)
response = Response(output=None, errors=[msg])
self._send_response(response)
return response
else:
action = self.expand_value_from_context(self.action, **context)
(module_name, method_name) = get_module_and_method_from_action(action)
plugin = get_plugin(module_name)
try:
# Run the action
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment