actually fix typehint and you can only throw Exception inheritors

This commit is contained in:
jesopo 2020-08-26 10:32:31 +00:00
parent ee9d5a304f
commit eec8d1a6a6

View file

@ -116,7 +116,7 @@ class Bot(object):
self._trigger_both() self._trigger_both()
return returned return returned
func_queue: queue.Queue[typing.Tuple[TriggerResult, str] func_queue: queue.Queue[typing.Tuple[TriggerResult, typing.Any]
] = queue.Queue(1) ] = queue.Queue(1)
def _action(): def _action():
@ -135,7 +135,8 @@ class Bot(object):
if trigger_threads: if trigger_threads:
self._trigger_both() self._trigger_both()
if type == TriggerResult.Exception: if (type == TriggerResult.Exception and
isinstance(returned, Exception)):
raise returned raise returned
elif type == TriggerResult.Return: elif type == TriggerResult.Return:
return returned return returned