mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-05-04 10:34:26 +08:00
fix(error-handling): replace bare except clauses with specific exceptions
- qb_downloader.py: catch httpx network errors in logout() and rename_file() - user.py: log exception details when querying users table fails - download_client.py: log exception when category creation fails - title_parser.py: catch specific exceptions (ValueError, AttributeError, TypeError) instead of broad Exception in raw_parser() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,9 @@ class TitleParser:
|
||||
|
||||
@staticmethod
|
||||
async def tmdb_poster_parser(bangumi: Bangumi):
|
||||
tmdb_info = await tmdb_parser(bangumi.official_title, settings.rss_parser.language)
|
||||
tmdb_info = await tmdb_parser(
|
||||
bangumi.official_title, settings.rss_parser.language
|
||||
)
|
||||
if tmdb_info:
|
||||
logger.debug(f"TMDB Matched, official title is {tmdb_info.title}")
|
||||
bangumi.poster_link = tmdb_info.poster_link
|
||||
@@ -98,9 +100,8 @@ class TitleParser:
|
||||
offset=0,
|
||||
filter=",".join(settings.rss_parser.filter),
|
||||
)
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
logger.warning(f"Cannot parse {raw}.")
|
||||
except (ValueError, AttributeError, TypeError) as e:
|
||||
logger.warning(f"Cannot parse '{raw}': {type(e).__name__}: {e}")
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user