mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 12:02:16 +00:00
🎨 Update global exception handler
This commit is contained in:
parent
9e81ee5164
commit
0b9c0a82fa
@ -100,7 +100,7 @@ def error_callable(func: Callable) -> Callable:
|
|||||||
await send_user_notification(update, context, f"出错了呜呜呜 ~ Cookie 无效 错误信息为 {exc.msg} 请尝试重新绑定")
|
await send_user_notification(update, context, f"出错了呜呜呜 ~ Cookie 无效 错误信息为 {exc.msg} 请尝试重新绑定")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
except TooManyRequests as exc:
|
except TooManyRequests as exc:
|
||||||
logger.warning("查询次数太多(操作频繁)", exc)
|
logger.warning("查询次数太多(操作频繁) %s", exc)
|
||||||
await send_user_notification(update, context, "出错了呜呜呜 ~ 当天查询次数已经超过30次,请次日再进行查询")
|
await send_user_notification(update, context, "出错了呜呜呜 ~ 当天查询次数已经超过30次,请次日再进行查询")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
except DataNotPublic:
|
except DataNotPublic:
|
||||||
@ -111,6 +111,12 @@ def error_callable(func: Callable) -> Callable:
|
|||||||
await send_user_notification(update, context, "出错了呜呜呜 ~ 未设置默认角色,请尝试重新绑定")
|
await send_user_notification(update, context, "出错了呜呜呜 ~ 未设置默认角色,请尝试重新绑定")
|
||||||
elif exc.retcode == 1034:
|
elif exc.retcode == 1034:
|
||||||
await send_user_notification(update, context, "出错了呜呜呜 ~ 服务器检测到该账号可能存在异常,请求被拒绝,请尝试通过验证")
|
await send_user_notification(update, context, "出错了呜呜呜 ~ 服务器检测到该账号可能存在异常,请求被拒绝,请尝试通过验证")
|
||||||
|
elif exc.retcode == -500001:
|
||||||
|
await send_user_notification(update, context, "出错了呜呜呜 ~ 网络出小差了,请稍后重试~")
|
||||||
|
elif exc.retcode == -1:
|
||||||
|
await send_user_notification(update, context, "出错了呜呜呜 ~ 系统发生错误,请稍后重试~")
|
||||||
|
elif exc.retcode == -10001: # 参数异常 应该抛出错误
|
||||||
|
raise exc
|
||||||
else:
|
else:
|
||||||
logger.error("GenshinException")
|
logger.error("GenshinException")
|
||||||
logger.exception(exc)
|
logger.exception(exc)
|
||||||
|
Loading…
Reference in New Issue
Block a user