forked from platypush/platypush
Errors should be caught also before a request action is executed (prevents HTTP timeouts when the error is on e.g. get_plugin() level)
This commit is contained in:
parent
fa17011b24
commit
e3f0219554
1 changed files with 20 additions and 12 deletions
|
@ -207,6 +207,7 @@ class Request(Message):
|
|||
def _thread_func(_n_tries, errors=None):
|
||||
response = None
|
||||
|
||||
try:
|
||||
if self.action.startswith('procedure.'):
|
||||
context['n_tries'] = _n_tries
|
||||
response = self._execute_procedure(**context)
|
||||
|
@ -222,6 +223,13 @@ class Request(Message):
|
|||
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
|
||||
|
||||
try:
|
||||
# Run the action
|
||||
|
|
Loading…
Reference in a new issue