🎨 Update error handler for NetworkError and TimedOut exceptions

This commit is contained in:
洛水居室 2022-12-04 20:02:01 +08:00
parent e20e20111d
commit 99f2482caf
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -33,10 +33,10 @@ class ErrorHandler(Plugin):
"""记录错误并发送消息通知开发人员。 logger the error and send a telegram message to notify the developer.""" """记录错误并发送消息通知开发人员。 logger the error and send a telegram message to notify the developer."""
if isinstance(context.error, NetworkError): if isinstance(context.error, NetworkError):
logger.error("Bot请求异常", exc_info=context.error) logger.error("Bot请求异常 %s", context.error.message)
return return
if isinstance(context.error, TimedOut): if isinstance(context.error, TimedOut):
logger.error("Bot请求超时", exc_info=context.error) logger.error("Bot请求超时 %s", context.error.message)
return return
logger.error("处理函数时发生异常") logger.error("处理函数时发生异常")