From eec8d1a6a64664c8f279edb843641fd03eeab255 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Aug 2020 10:32:31 +0000 Subject: [PATCH] actually fix typehint and you can only throw Exception inheritors --- src/IRCBot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/IRCBot.py b/src/IRCBot.py index 843fb6e6..8c7bdf47 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -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