mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-29 02:57:22 +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
|
import aiofiles
|
||||||
from aiohttp import ClientError, ClientConnectorError
|
from aiohttp import ClientError, ClientConnectorError
|
||||||
from genshin import DataNotPublic, GenshinException, InvalidCookies, TooManyRequests
|
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 import ReplyKeyboardRemove, Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
from telegram.constants import ParseMode
|
from telegram.constants import ParseMode
|
||||||
from telegram.error import BadRequest, Forbidden, TelegramError, TimedOut, NetworkError
|
from telegram.error import BadRequest, Forbidden, TelegramError, TimedOut, NetworkError
|
||||||
@ -184,8 +184,9 @@ class ErrorHandler(Plugin):
|
|||||||
return
|
return
|
||||||
exc = context.error
|
exc = context.error
|
||||||
notice: Optional[str] = None
|
notice: Optional[str] = None
|
||||||
if isinstance(exc, HttpxTimeout):
|
if isinstance(exc, TimeoutException):
|
||||||
notice = self.ERROR_MSG_PREFIX + " 连接连接服务器异常"
|
notice = self.ERROR_MSG_PREFIX + " 连接连接服务器异常"
|
||||||
|
logger.warning("Httpx exception[%s]", str(exc))
|
||||||
if notice:
|
if notice:
|
||||||
self.create_notice_task(update, context, notice)
|
self.create_notice_task(update, context, notice)
|
||||||
raise ApplicationHandlerStop
|
raise ApplicationHandlerStop
|
||||||
|
Loading…
Reference in New Issue
Block a user