From d6d2506f253824857a94bf033072524f789a81df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sun, 19 Nov 2023 00:46:27 +0800 Subject: [PATCH] :art: Add error handling for `InvalidDevice` --- plugins/system/errorhandler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/system/errorhandler.py b/plugins/system/errorhandler.py index 89b83ccc..8f4f5ae4 100644 --- a/plugins/system/errorhandler.py +++ b/plugins/system/errorhandler.py @@ -14,6 +14,7 @@ from simnet.errors import ( TimedOut as SIMNetTimedOut, SIMNetException, NeedChallenge, + InvalidDevice, ) from telegram import ReplyKeyboardRemove, Update, InlineKeyboardMarkup, InlineKeyboardButton from telegram.constants import ParseMode @@ -145,6 +146,8 @@ class ErrorHandler(Plugin): else: logger.error("未知Cookie错误", exc_info=exc) notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定" + elif isinstance(exc, InvalidDevice): + notice = self.ERROR_MSG_PREFIX + "设备信息无效,请尝试重新设备绑定" elif isinstance(exc, DataNotPublic): notice = self.ERROR_MSG_PREFIX + "查询的用户数据未公开" elif isinstance(exc, NeedChallenge):