From 7cdc453a222c2b9b8d46e2bb0f4157c33a7fad32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Thu, 16 Nov 2023 14:09:54 +0800 Subject: [PATCH] :bug: Correct Order of Exception Clauses Resolves PYL-E0701: Bad except clauses order (ValueError is an ancestor class of UnicodeEncodeError) --- plugins/account/cookies.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/account/cookies.py b/plugins/account/cookies.py index 30733b0f..c4fa2eb5 100644 --- a/plugins/account/cookies.py +++ b/plugins/account/cookies.py @@ -248,14 +248,14 @@ class AccountCookiesPlugin(Plugin.Conversation): logger.warning("用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original) await message.reply_text("Stoken 无效,请重新绑定。", reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END + except UnicodeEncodeError: + await message.reply_text("Stoken 非法,请重新绑定。", reply_markup=ReplyKeyboardRemove()) + return ConversationHandler.END except ValueError as e: if "account_id" in str(e): await message.reply_text("account_id 未找到,请检查输入是否有误。") return ConversationHandler.END raise e - except UnicodeEncodeError: - await message.reply_text("Stoken 非法,请重新绑定。", reply_markup=ReplyKeyboardRemove()) - return ConversationHandler.END try: if cookies.account_id is None: logger.info("正在尝试获取用户 %s[%s] account_id", user.full_name, user.id)