🐛 Fix Handling Exception Error

This commit is contained in:
洛水居室 2023-02-09 13:57:16 +08:00
parent ef31faf1ae
commit 5f3da3b55c
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -18,6 +18,7 @@ from enkanetwork import (
EnkaServerMaintanance, EnkaServerMaintanance,
EnkaServerUnknown, EnkaServerUnknown,
EnkaServerRateLimit, EnkaServerRateLimit,
EnkaPlayerNotFound,
) )
from pydantic import BaseModel from pydantic import BaseModel
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
@ -78,8 +79,10 @@ class PlayerCards(Plugin, BasePlugin):
error = "Enka.Network 服务请求错误,请稍后重试" error = "Enka.Network 服务请求错误,请稍后重试"
except EnkaServerUnknown: except EnkaServerUnknown:
error = "Enka.Network 服务瞬间爆炸,请稍后重试" error = "Enka.Network 服务瞬间爆炸,请稍后重试"
except (VaildateUIDError, VaildateUIDError): except EnkaPlayerNotFound:
error = "UID 未找到,可能为服务器抽风,请稍后重试" error = "UID 未找到,可能为服务器抽风,请稍后重试"
except VaildateUIDError:
error = "未找到玩家请检查您的UID/用户名"
except HTTPException: except HTTPException:
error = "Enka.Network HTTP 服务请求错误,请稍后重试" error = "Enka.Network HTTP 服务请求错误,请稍后重试"
old_data = await self.player_cards_file.load_history_info(uid) old_data = await self.player_cards_file.load_history_info(uid)