Support for (output, errors) as a tuple returned from plugin actions
This commit is contained in:
parent
2dac094aea
commit
db4330eeed
1 changed files with 6 additions and 1 deletions
|
@ -14,8 +14,13 @@ def action(f):
|
||||||
try:
|
try:
|
||||||
output = f(*args, **kwargs)
|
output = f(*args, **kwargs)
|
||||||
if output and isinstance(output, Response):
|
if output and isinstance(output, Response):
|
||||||
errors = output.errors
|
errors = output.errors \
|
||||||
|
if isinstance(output.errors, list) else [output.errors]
|
||||||
output = output.output
|
output = output.output
|
||||||
|
elif isinstance(output, tuple) and len(output) == 2:
|
||||||
|
errors = output[1] \
|
||||||
|
if isinstance(output.errors, list) else [output[1]]
|
||||||
|
output = output[0]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(args[0], Plugin):
|
if isinstance(args[0], Plugin):
|
||||||
args[0].logger.exception(e)
|
args[0].logger.exception(e)
|
||||||
|
|
Loading…
Reference in a new issue