mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-21 22:58:05 +00:00
🐛 Fix incorrect handling of timeout exceptions in httpx
This commit is contained in:
parent
503bd0b498
commit
e24cd2a44d
@ -6,7 +6,7 @@ from typing import Optional
|
||||
import aiofiles
|
||||
from aiohttp import ClientError, ClientConnectorError
|
||||
from genshin import DataNotPublic, GenshinException, InvalidCookies, TooManyRequests
|
||||
from httpx import Timeout as HttpxTimeout, HTTPError
|
||||
from httpx import HTTPError, TimeoutException
|
||||
from telegram import ReplyKeyboardRemove, Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from telegram.constants import ParseMode
|
||||
from telegram.error import BadRequest, Forbidden, TelegramError, TimedOut, NetworkError
|
||||
@ -184,8 +184,9 @@ class ErrorHandler(Plugin):
|
||||
return
|
||||
exc = context.error
|
||||
notice: Optional[str] = None
|
||||
if isinstance(exc, HttpxTimeout):
|
||||
if isinstance(exc, TimeoutException):
|
||||
notice = self.ERROR_MSG_PREFIX + " 连接连接服务器异常"
|
||||
logger.warning("Httpx exception[%s]", str(exc))
|
||||
if notice:
|
||||
self.create_notice_task(update, context, notice)
|
||||
raise ApplicationHandlerStop
|
||||
|
Loading…
Reference in New Issue
Block a user