mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-21 14:48:29 +00:00
🐛 Fix handle PlaywrightTimeoutError
This commit is contained in:
parent
8b17c74d9e
commit
1378970fea
@ -6,6 +6,7 @@ from typing import Optional
|
|||||||
|
|
||||||
import aiofiles
|
import aiofiles
|
||||||
from httpx import HTTPError, TimeoutException
|
from httpx import HTTPError, TimeoutException
|
||||||
|
from playwright.async_api import Error as PlaywrightError, TimeoutError as PlaywrightTimeoutError
|
||||||
from simnet.errors import (
|
from simnet.errors import (
|
||||||
DataNotPublic,
|
DataNotPublic,
|
||||||
BadRequest as SIMNetBadRequest,
|
BadRequest as SIMNetBadRequest,
|
||||||
@ -279,6 +280,15 @@ class ErrorHandler(Plugin):
|
|||||||
self.create_notice_task(update, context, config.notice.user_not_found)
|
self.create_notice_task(update, context, config.notice.user_not_found)
|
||||||
raise ApplicationHandlerStop
|
raise ApplicationHandlerStop
|
||||||
|
|
||||||
|
@error_handler()
|
||||||
|
async def process_playwright_exception(self, update: object, context: CallbackContext):
|
||||||
|
if not isinstance(context.error, PlaywrightError) or not isinstance(update, Update):
|
||||||
|
return
|
||||||
|
if isinstance(context.error, PlaywrightTimeoutError):
|
||||||
|
notice = self.ERROR_MSG_PREFIX + " 渲染超时 ~ 请稍后再试"
|
||||||
|
self.create_notice_task(update, context, notice)
|
||||||
|
raise ApplicationHandlerStop
|
||||||
|
|
||||||
@error_handler(block=False)
|
@error_handler(block=False)
|
||||||
async def process_z_error(self, update: object, context: CallbackContext) -> None:
|
async def process_z_error(self, update: object, context: CallbackContext) -> None:
|
||||||
# 必须 `process_` 加上 `z` 保证该函数最后一个注册
|
# 必须 `process_` 加上 `z` 保证该函数最后一个注册
|
||||||
|
Loading…
Reference in New Issue
Block a user