🎨 Add error handling for InvalidDevice

This commit is contained in:
洛水居室 2023-11-19 00:46:27 +08:00
parent 339f386997
commit d6d2506f25
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -14,6 +14,7 @@ from simnet.errors import (
TimedOut as SIMNetTimedOut, TimedOut as SIMNetTimedOut,
SIMNetException, SIMNetException,
NeedChallenge, NeedChallenge,
InvalidDevice,
) )
from telegram import ReplyKeyboardRemove, Update, InlineKeyboardMarkup, InlineKeyboardButton from telegram import ReplyKeyboardRemove, Update, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.constants import ParseMode from telegram.constants import ParseMode
@ -145,6 +146,8 @@ class ErrorHandler(Plugin):
else: else:
logger.error("未知Cookie错误", exc_info=exc) logger.error("未知Cookie错误", exc_info=exc)
notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定" notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定"
elif isinstance(exc, InvalidDevice):
notice = self.ERROR_MSG_PREFIX + "设备信息无效,请尝试重新设备绑定"
elif isinstance(exc, DataNotPublic): elif isinstance(exc, DataNotPublic):
notice = self.ERROR_MSG_PREFIX + "查询的用户数据未公开" notice = self.ERROR_MSG_PREFIX + "查询的用户数据未公开"
elif isinstance(exc, NeedChallenge): elif isinstance(exc, NeedChallenge):