From da290dad07b748be52764d25d8b5b9615c6a714e Mon Sep 17 00:00:00 2001 From: AkiraXie Date: Wed, 24 Feb 2021 23:56:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20=20fix=20ValueError=20to=20Excep?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot/plugins/single_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonebot/plugins/single_session.py b/nonebot/plugins/single_session.py index 94558553..30fdc496 100644 --- a/nonebot/plugins/single_session.py +++ b/nonebot/plugins/single_session.py @@ -12,7 +12,7 @@ _running_matcher: Dict[str, int] = {} async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): try: session_id = event.get_session_id() - except ValueError: + except Exception: return current_event_id = id(event) event_id = _running_matcher.get(session_id, None) @@ -26,7 +26,7 @@ async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): async def _(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State): try: session_id = event.get_session_id() - except ValueError: + except Exception: return if session_id in _running_matcher: del _running_matcher[session_id]