🔊 fix error uncatched in bot.handle_message

This commit is contained in:
yanyongyu 2020-09-14 21:51:40 +08:00
parent c2badaec42
commit adc69a2763

View File

@ -214,6 +214,7 @@ class Bot(BaseBot):
ResultStore.add_result(message) ResultStore.add_result(message)
return return
try:
event = Event(message) event = Event(message)
# Check whether user is calling me # Check whether user is calling me
@ -222,6 +223,10 @@ class Bot(BaseBot):
_check_nickname(self, event) _check_nickname(self, event)
await handle_event(self, event) await handle_event(self, event)
except Exception as e:
logger.opt(colors=True, exception=e).error(
f"<r><bg #f8bbd0>Failed to handle event. Raw: {message}</bg #f8bbd0></r>"
)
@overrides(BaseBot) @overrides(BaseBot)
async def call_api(self, api: str, **data) -> Union[Any, NoReturn]: async def call_api(self, api: str, **data) -> Union[Any, NoReturn]: