From 0cd28f7499448a66e87996e848f75e5fb7237299 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 10 Apr 2020 00:06:36 +0200 Subject: [PATCH] If the response contains errors in run() then raise a RuntimeError, otherwise return the output instead of the Response object --- platypush/utils/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platypush/utils/__init__.py b/platypush/utils/__init__.py index 1ad57833..1a11a2d4 100644 --- a/platypush/utils/__init__.py +++ b/platypush/utils/__init__.py @@ -295,7 +295,12 @@ def run(action, *args, **kwargs): (module_name, method_name) = get_module_and_method_from_action(action) plugin = get_plugin(module_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: