raise if a 'publish' function failed

This commit is contained in:
Emmanuel Garette 2020-03-25 08:47:26 +01:00
parent 867de5f56e
commit e58c61b76a
1 changed files with 10 additions and 24 deletions

View File

@ -320,33 +320,19 @@ class Dispatcher(register.RegisterDispatcher,
module_name = function.__module__.split('.')[-2]
function_name = function.__name__
info_msg = _(f'in module {module_name}.{function_name}')
try:
# build argument for this function
if risotto_context.type == 'rpc':
kw = config_arguments
else:
kw = {}
for key, value in config_arguments.items():
if key in function_obj['arguments']:
kw[key] = value
# build argument for this function
if risotto_context.type == 'rpc':
kw = config_arguments
else:
kw = {}
for key, value in config_arguments.items():
if key in function_obj['arguments']:
kw[key] = value
kw['risotto_context'] = risotto_context
returns = await function(self.injected_self[function_obj['module']], **kw)
except CallError as err:
if risotto_context.type == 'rpc':
raise err
continue
except Exception as err:
if risotto_context.type == 'rpc':
raise err
if get_config().get('global').get('debug'):
print_exc()
await log.error_msg(risotto_context,
kwargs,
err)
continue
kw['risotto_context'] = risotto_context
returns = await function(self.injected_self[function_obj['module']], **kw)
else:
if risotto_context.type == 'rpc':
# valid returns