Do exception logging at Request level and discard duplicate exception messages between retries
This commit is contained in:
parent
8ea0519954
commit
db4e68e247
2 changed files with 14 additions and 17 deletions
|
@ -215,12 +215,15 @@ class Request(Message):
|
|||
format(plugin, self.action, str(response)))
|
||||
except Exception as e:
|
||||
# Retry mechanism
|
||||
plugin.logger.exception(e)
|
||||
logger.warning(('Uncaught exception while processing response ' +
|
||||
'from action {}.{}: {}').format(
|
||||
plugin, self.action, str(e)))
|
||||
|
||||
errors = errors or []
|
||||
if str(e) not in errors:
|
||||
errors.append(str(e))
|
||||
|
||||
response = Response(output=None, errors=errors)
|
||||
if n_tries-1 > 0:
|
||||
logger.info('Reloading plugin {} and retrying'.format(module_name))
|
||||
|
|
|
@ -14,7 +14,6 @@ def action(f):
|
|||
output = None
|
||||
errors = []
|
||||
|
||||
try:
|
||||
output = f(*args, **kwargs)
|
||||
if output and isinstance(output, Response):
|
||||
errors = output.errors \
|
||||
|
@ -26,11 +25,6 @@ def action(f):
|
|||
|
||||
if len(errors) == 1 and errors[0] is None: errors = []
|
||||
output = output[0]
|
||||
except Exception as e:
|
||||
if isinstance(args[0], Plugin):
|
||||
args[0].logger.exception(e)
|
||||
raise e
|
||||
# errors.append(str(e) + '\n' + traceback.format_exc())
|
||||
|
||||
return Response(output=output, errors=errors)
|
||||
|
||||
|
|
Loading…
Reference in a new issue