Skip to content

Commit

Permalink
🥅 chore: refine error msg (fixes #99)
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo committed Dec 20, 2022
1 parent 439e9ee commit a4c87c7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions yutto/utils/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ async def connect_n_times(*args: Any, **kwargs: Any) -> T:
while retry:
try:
return await connect_once(*args, **kwargs)
except (
aiohttp.client_exceptions.ClientPayloadError, # type: ignore
aiohttp.client_exceptions.ClientConnectorError, # type: ignore
aiohttp.client_exceptions.ServerDisconnectedError, # type: ignore
aiohttp.client_exceptions.ClientHttpProxyError, # type: ignore
):
except aiohttp.ClientError as e:
await asyncio.sleep(0.5)
Logger.warning(f"抓取失败,正在重试,剩余 {retry - 1} 次")
error_type = e.__class__.__name__
Logger.warning(f"抓取失败({error_type}),正在重试,剩余 {retry - 1} 次")
except asyncio.TimeoutError:
Logger.warning(f"抓取超时,正在重试,剩余 {retry - 1} 次")
finally:
Expand Down

0 comments on commit a4c87c7

Please sign in to comment.