actually fix typehint and you can only throw Exception inheritors
This commit is contained in:
parent
ee9d5a304f
commit
eec8d1a6a6
1 changed files with 3 additions and 2 deletions
|
@ -116,7 +116,7 @@ class Bot(object):
|
|||
self._trigger_both()
|
||||
return returned
|
||||
|
||||
func_queue: queue.Queue[typing.Tuple[TriggerResult, str]
|
||||
func_queue: queue.Queue[typing.Tuple[TriggerResult, typing.Any]
|
||||
] = queue.Queue(1)
|
||||
|
||||
def _action():
|
||||
|
@ -135,7 +135,8 @@ class Bot(object):
|
|||
if trigger_threads:
|
||||
self._trigger_both()
|
||||
|
||||
if type == TriggerResult.Exception:
|
||||
if (type == TriggerResult.Exception and
|
||||
isinstance(returned, Exception)):
|
||||
raise returned
|
||||
elif type == TriggerResult.Return:
|
||||
return returned
|
||||
|
|
Loading…
Reference in a new issue