diff --git a/nonebot/message.py b/nonebot/message.py index d994dddb..b853e481 100644 --- a/nonebot/message.py +++ b/nonebot/message.py @@ -176,7 +176,7 @@ async def _run_matcher(Matcher: Type[Matcher], bot: "Bot", event: "Event", return -async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: +async def handle_event(bot: "Bot", event: "Event") -> None: """ :说明: @@ -213,12 +213,12 @@ async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: except IgnoredException as e: logger.opt(colors=True).info( f"Event {escape_tag(event.get_event_name())} is ignored") - return e + return except Exception as e: logger.opt(colors=True, exception=e).error( "Error when running EventPreProcessors. " "Event ignored!") - return e + return # Trie Match _, _ = TrieRule.get_value(bot, event, state) @@ -248,7 +248,6 @@ async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: logger.opt(colors=True, exception=result).error( "Error when checking Matcher." ) - return result coros = list(map(lambda x: x(bot, event, state), _event_postprocessors)) if coros: @@ -260,4 +259,3 @@ async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: logger.opt(colors=True, exception=e).error( "Error when running EventPostProcessors" ) - return e