Skip to content

Commit

Permalink
perf: 优化异常信息提示
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeanAmier committed Aug 18, 2024
1 parent 76e40b6 commit 0616139
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
Binary file modified locale/en_GB/LC_MESSAGES/xhs.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions locale/en_GB/LC_MESSAGES/xhs.po
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ msgstr "Do you need to update the configuration file"
msgid "查看详细参数说明"
msgstr "View detailed parameter descriptions"

msgid "网络异常,请求 {0} 失败"
msgstr "Network error, failed to access {0}"
msgid "网络异常,{0} 请求失败: {1}"
msgstr "Network error, {0} request failed: {1}"

msgid "{0} 文件已存在,跳过下载"
msgstr "{0} already exists, skipping download"
Expand Down
2 changes: 1 addition & 1 deletion locale/zh_CN/LC_MESSAGES/xhs.po
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ msgstr ""
msgid "查看详细参数说明"
msgstr ""

msgid "网络异常,请求 {0} 失败"
msgid "网络异常,{0} 请求失败: {1}"
msgstr ""

msgid "{0} 文件已存在,跳过下载"
Expand Down
4 changes: 2 additions & 2 deletions source/application/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def __download(self, url: str, path: Path, name: str, format_: str, log, b
logging(
log,
self.message(
"网络异常,{0} 请求失败,错误信息: {1}").format(name, error),
"网络异常,{0} 请求失败,错误信息: {1}").format(name, repr(error)),
ERROR,
)
logging(
Expand Down Expand Up @@ -170,7 +170,7 @@ async def __download(self, url: str, path: Path, name: str, format_: str, log, b
logging(
log,
self.message(
"网络异常,{0} 下载失败,错误信息: {1}").format(name, error),
"网络异常,{0} 下载失败,错误信息: {1}").format(name, repr(error)),
ERROR,
)
logging(
Expand Down
6 changes: 4 additions & 2 deletions source/application/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ async def request_url(
response = await self.__request_url_head(url, headers, **kwargs, )
return str(response.url)
except HTTPError as error:
logging(log, str(error), ERROR)
logging(
log, self.message("网络异常,请求 {0} 失败").format(url), ERROR)
log,
self.message("网络异常,{0} 请求失败: {1}").format(url, repr(error)),
ERROR
)
return ""

@staticmethod
Expand Down

0 comments on commit 0616139

Please sign in to comment.