If the response contains errors in run() then raise a RuntimeError, otherwise return the output instead of the Response object
This commit is contained in:
parent
7b79e4b669
commit
0cd28f7499
1 changed files with 6 additions and 1 deletions
|
@ -295,7 +295,12 @@ def run(action, *args, **kwargs):
|
||||||
(module_name, method_name) = get_module_and_method_from_action(action)
|
(module_name, method_name) = get_module_and_method_from_action(action)
|
||||||
plugin = get_plugin(module_name)
|
plugin = get_plugin(module_name)
|
||||||
method = getattr(plugin, method_name)
|
method = getattr(plugin, method_name)
|
||||||
return method(*args, **kwargs)
|
response = method(*args, **kwargs)
|
||||||
|
|
||||||
|
if response.errors:
|
||||||
|
raise RuntimeError(response.errors[0])
|
||||||
|
|
||||||
|
return response.output
|
||||||
|
|
||||||
|
|
||||||
# vim:sw=4:ts=4:et:
|
# vim:sw=4:ts=4:et:
|
||||||
|
|
Loading…
Reference in a new issue