From 533be390faf2ff0ffab40f2f413d352ea599c9b6 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Thu, 19 Aug 2021 23:21:30 +0800 Subject: [PATCH] :bug: fix playwright screenshot error handle Fix QQ-GITHUB-BOT-2V --- src/plugins/github/plugins/github_issue/__init__.py | 8 ++++---- src/plugins/github/plugins/github_reply/content.py | 6 +++--- src/plugins/github/plugins/github_reply/diff.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/github/plugins/github_issue/__init__.py b/src/plugins/github/plugins/github_issue/__init__.py index 13ac689..724f50d 100644 --- a/src/plugins/github/plugins/github_issue/__init__.py +++ b/src/plugins/github/plugins/github_issue/__init__.py @@ -4,7 +4,7 @@ @Author : yanyongyu @Date : 2021-03-09 15:15:02 @LastEditors : yanyongyu -@LastEditTime : 2021-08-19 23:07:33 +@LastEditTime : 2021-08-19 23:19:12 @Description : None @GitHub : https://github.com/yanyongyu """ @@ -16,7 +16,7 @@ from typing import Dict from nonebot import on_regex from nonebot.typing import T_State -from playwright.async_api import TimeoutError +from playwright.async_api import Error from httpx import HTTPStatusError, TimeoutException from nonebot.adapters.cqhttp import Bot, MessageEvent, MessageSegment, GroupMessageEvent @@ -77,7 +77,7 @@ async def handle(bot: Bot, event: MessageEvent, state: T_State): img = await issue_to_image(owner, repo, issue_) except TimeoutException: await issue.finish(f"获取issue数据超时!请尝试重试") - except TimeoutError: + except Error: await issue.finish(f"生成图片超时!请尝试重试") else: if img: @@ -127,7 +127,7 @@ async def handle_short(bot: Bot, event: GroupMessageEvent, state: T_State): img = await issue_to_image(owner, repo, issue_) except TimeoutException: await issue.finish(f"获取issue数据超时!请尝试重试") - except TimeoutError: + except Error: await issue.finish(f"生成图片超时!请尝试重试") else: if img: diff --git a/src/plugins/github/plugins/github_reply/content.py b/src/plugins/github/plugins/github_reply/content.py index 6ee2f20..008be44 100644 --- a/src/plugins/github/plugins/github_reply/content.py +++ b/src/plugins/github/plugins/github_reply/content.py @@ -4,7 +4,7 @@ @Author : yanyongyu @Date : 2021-03-26 14:45:05 @LastEditors : yanyongyu -@LastEditTime : 2021-08-19 23:09:17 +@LastEditTime : 2021-08-19 23:19:21 @Description : None @GitHub : https://github.com/yanyongyu """ @@ -14,7 +14,7 @@ import base64 from nonebot import on_command from nonebot.typing import T_State -from playwright.async_api import TimeoutError +from playwright.async_api import Error from httpx import HTTPStatusError, TimeoutException from nonebot.adapters.cqhttp import Bot, MessageEvent, MessageSegment @@ -60,7 +60,7 @@ async def handle_content(bot: Bot, event: MessageEvent, state: T_State): issue_) except TimeoutException: await content.finish(f"获取issue数据超时!请尝试重试") - except TimeoutError: + except Error: await content.finish(f"生成图片超时!请尝试重试") else: if img: diff --git a/src/plugins/github/plugins/github_reply/diff.py b/src/plugins/github/plugins/github_reply/diff.py index 31a0e92..1553e63 100644 --- a/src/plugins/github/plugins/github_reply/diff.py +++ b/src/plugins/github/plugins/github_reply/diff.py @@ -4,7 +4,7 @@ @Author : yanyongyu @Date : 2021-03-26 14:59:59 @LastEditors : yanyongyu -@LastEditTime : 2021-08-19 23:09:30 +@LastEditTime : 2021-08-19 23:25:50 @Description : None @GitHub : https://github.com/yanyongyu """ @@ -14,7 +14,7 @@ import base64 from nonebot import on_command from nonebot.typing import T_State -from playwright.async_api import TimeoutError +from playwright.async_api import Error from httpx import HTTPStatusError, TimeoutException from nonebot.adapters.cqhttp import Bot, MessageEvent, MessageSegment @@ -60,7 +60,7 @@ async def handle_diff(bot: Bot, event: MessageEvent, state: T_State): issue_) except TimeoutException: await diff.finish(f"获取diff数据超时!请尝试重试") - except TimeoutError: + except Error: await diff.finish(f"生成图片超时!请尝试重试") else: if img: