🥅 fix ValueError to Exception

This commit is contained in:
AkiraXie 2021-02-24 23:56:52 +08:00
parent 6f2b9a1d13
commit da290dad07

View File

@ -12,7 +12,7 @@ _running_matcher: Dict[str, int] = {}
async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State):
try: try:
session_id = event.get_session_id() session_id = event.get_session_id()
except ValueError: except Exception:
return return
current_event_id = id(event) current_event_id = id(event)
event_id = _running_matcher.get(session_id, None) 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): async def _(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State):
try: try:
session_id = event.get_session_id() session_id = event.get_session_id()
except ValueError: except Exception:
return return
if session_id in _running_matcher: if session_id in _running_matcher:
del _running_matcher[session_id] del _running_matcher[session_id]