raise if a 'publish' function failed
This commit is contained in:
parent
e58c61b76a
commit
197a9e82a2
@ -333,32 +333,31 @@ class Dispatcher(register.RegisterDispatcher,
|
|||||||
|
|
||||||
kw['risotto_context'] = risotto_context
|
kw['risotto_context'] = risotto_context
|
||||||
returns = await function(self.injected_self[function_obj['module']], **kw)
|
returns = await function(self.injected_self[function_obj['module']], **kw)
|
||||||
else:
|
if risotto_context.type == 'rpc':
|
||||||
if risotto_context.type == 'rpc':
|
# valid returns
|
||||||
# valid returns
|
await self.valid_call_returns(risotto_context,
|
||||||
await self.valid_call_returns(risotto_context,
|
function,
|
||||||
function,
|
returns,
|
||||||
returns,
|
kwargs)
|
||||||
kwargs)
|
# log the success
|
||||||
# log the success
|
await log.info_msg(risotto_context,
|
||||||
await log.info_msg(risotto_context,
|
{'arguments': kwargs,
|
||||||
{'arguments': kwargs,
|
'returns': returns},
|
||||||
'returns': returns},
|
info_msg)
|
||||||
info_msg)
|
# notification
|
||||||
# notification
|
if function_obj.get('notification'):
|
||||||
if function_obj.get('notification'):
|
notif_version, notif_message = function_obj['notification'].split('.', 1)
|
||||||
notif_version, notif_message = function_obj['notification'].split('.', 1)
|
if not isinstance(returns, list):
|
||||||
if not isinstance(returns, list):
|
send_returns = [returns]
|
||||||
send_returns = [returns]
|
else:
|
||||||
else:
|
send_returns = returns
|
||||||
send_returns = returns
|
for ret in send_returns:
|
||||||
for ret in send_returns:
|
await self.publish(notif_version,
|
||||||
await self.publish(notif_version,
|
notif_message,
|
||||||
notif_message,
|
risotto_context,
|
||||||
risotto_context,
|
**ret)
|
||||||
**ret)
|
if risotto_context.type == 'rpc':
|
||||||
if risotto_context.type == 'rpc':
|
return returns
|
||||||
return returns
|
|
||||||
|
|
||||||
|
|
||||||
dispatcher = Dispatcher()
|
dispatcher = Dispatcher()
|
||||||
|
Loading…
Reference in New Issue
Block a user