Surface silent exceptions in workers + repair jobs — ~30 sites

Across all background workers (Spotify/Tidal/Deezer/Qobuz/iTunes/
Discogs/Genius/AudioDB/MusicBrainz/Last.fm/SoulID + the metadata-update
worker) and the repair-job scanners. All converted to
`logger.debug("...: %s", e)`.

Two `_e` renames in genius_worker and soulid_worker where outer scope
was already binding `e`. Two finally-block sites in repair_jobs/
library_reorganize.py left silent (conn.close on shutdown path).

Refs #369
This commit is contained in:
Broque Thomas 2026-05-07 10:27:24 -07:00
parent 8219771304
commit e95452b465
18 changed files with 52 additions and 52 deletions

View file

@ -140,8 +140,8 @@ class AudioDBWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue

View file

@ -141,8 +141,8 @@ class DeezerWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue

View file

@ -298,8 +298,8 @@ class DiscogsWorker:
self.stats['errors'] += 1
try:
self._mark_status(item['type'], item['id'], 'error')
except Exception:
pass
except Exception as e:
logger.debug("mark item status error failed: %s", e)
def _get_existing_id(self, entity_type: str, entity_id) -> Optional[str]:
"""Check if entity already has a discogs_id."""

View file

@ -154,8 +154,8 @@ class GeniusWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null-id item type lookup: %s", e)
continue
self._process_item(item)
@ -367,8 +367,8 @@ class GeniusWorker:
if song_url:
try:
lyrics = self.client.get_lyrics(song_url)
except Exception:
pass
except Exception as _e:
logger.debug("genius lyrics scrape: %s", _e)
self._update_track(track_id, full_song, full_song, lyrics)
self.stats['matched'] += 1
logger.info(f"Enriched track '{track_name}' from existing Genius ID: {existing_id}")

View file

@ -144,8 +144,8 @@ class iTunesWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue
self._process_item(item)

View file

@ -155,8 +155,8 @@ class LastFMWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue
self._process_item(item)

View file

@ -141,8 +141,8 @@ class MusicBrainzWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue

View file

@ -104,8 +104,8 @@ class QobuzWorker:
try:
if self.client:
authenticated = self.client.is_authenticated()
except Exception:
pass
except Exception as e:
logger.debug("qobuz auth status check: %s", e)
return {
'enabled': True,
@ -163,8 +163,8 @@ class QobuzWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null-id item type lookup: %s", e)
continue

View file

@ -62,8 +62,8 @@ def _read_tag(audio, tag_name):
if vals:
return vals[0].decode('utf-8') if isinstance(vals[0], bytes) else str(vals[0])
return None
except Exception:
pass
except Exception as e:
logger.debug("read tag value failed: %s", e)
return None

View file

@ -299,8 +299,8 @@ class DiscographyBackfillJob(RepairJob):
track_id = track_item.get('id', '')
if track_id and self._is_in_wishlist(context.db, track_id):
continue
except Exception:
pass
except Exception as e:
logger.debug("wishlist membership check failed: %s", e)
# Build wishlist-ready track data. album is a dict (required by
# add_to_wishlist and by the download pipeline's cover-art

View file

@ -337,8 +337,8 @@ class LibraryReorganizeJob(RepairJob):
if context.config_manager:
try:
active_server = context.config_manager.get_active_media_server()
except Exception:
pass
except Exception as e:
logger.debug("active media server lookup: %s", e)
try:
conn = context.db._get_connection()
try:

View file

@ -366,8 +366,8 @@ class MbidMismatchDetectorJob(RepairJob):
try:
from core.musicbrainz_client import MusicBrainzClient
mb_client = MusicBrainzClient()
except Exception:
pass
except Exception as e:
logger.debug("MusicBrainz client init failed: %s", e)
if not mb_client:
logger.warning("MusicBrainz client not available, skipping MBID mismatch scan")

View file

@ -159,8 +159,8 @@ class OrphanFileDetectorJob(RepairJob):
(first_artist and (clean_title, first_artist) in known_titles_clean)
):
is_known = True
except Exception:
pass
except Exception as e:
logger.debug("tag-based orphan check: %s", e)
# Last resort: parse title from filename pattern "NN - Title [Quality].ext"
# and match against known titles. Catches files with unreadable tags.
@ -186,8 +186,8 @@ class OrphanFileDetectorJob(RepairJob):
if clean_fn and (clean_fn, clean_fa) in known_titles_clean:
is_known = True
break
except Exception:
pass
except Exception as e:
logger.debug("filename-pattern orphan check: %s", e)
if not is_known:
orphan_files.append(fpath)

View file

@ -496,8 +496,8 @@ class UnknownArtistFixerJob(RepairJob):
if not os.path.exists(sidecar_dst):
try:
shutil.move(sidecar_src, sidecar_dst)
except Exception:
pass
except Exception as e:
logger.debug("move sidecar file: %s", e)
# Also move cover.jpg from old album folder
cover_src = os.path.join(src_dir, 'cover.jpg')
@ -505,8 +505,8 @@ class UnknownArtistFixerJob(RepairJob):
if os.path.isfile(cover_src) and not os.path.exists(cover_dst):
try:
shutil.copy2(cover_src, cover_dst)
except Exception:
pass
except Exception as e:
logger.debug("copy cover.jpg: %s", e)
# Clean up empty directories
parent = os.path.dirname(current_norm)

View file

@ -280,8 +280,8 @@ class SoulIDWorker:
if conn:
try:
conn.rollback()
except Exception:
pass
except Exception as _e:
logger.debug("rollback failed: %s", _e)
return 0
finally:
if conn:
@ -533,8 +533,8 @@ class SoulIDWorker:
if conn:
try:
conn.rollback()
except Exception:
pass
except Exception as _e:
logger.debug("rollback failed: %s", _e)
return 0
finally:
if conn:
@ -595,8 +595,8 @@ class SoulIDWorker:
if conn:
try:
conn.rollback()
except Exception:
pass
except Exception as _e:
logger.debug("rollback failed: %s", _e)
return 0
finally:
if conn:
@ -634,8 +634,8 @@ class SoulIDWorker:
if conn:
try:
conn.rollback()
except Exception:
pass
except Exception as _e:
logger.debug("rollback failed: %s", _e)
finally:
if conn:
conn.close()

View file

@ -234,8 +234,8 @@ class SpotifyWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null id table resolve failed: %s", e)
continue
self._process_item(item)

View file

@ -124,8 +124,8 @@ class TidalWorker:
authenticated = False
try:
authenticated = self.client.is_authenticated()
except Exception:
pass
except Exception as e:
logger.debug("tidal auth status check: %s", e)
return {
'enabled': True,
@ -176,8 +176,8 @@ class TidalWorker:
itype = item.get('type', '')
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
# Can't mark status without an ID — just skip
except Exception:
pass
except Exception as e:
logger.debug("null-id item type lookup: %s", e)
continue

View file

@ -209,8 +209,8 @@ class WebMetadataUpdateWorker:
raw = self._db.api_get_artist(best.id)
if raw:
spotify_artist_id = raw.get('spotify_artist_id')
except Exception:
pass
except Exception as e:
logger.debug("get spotify_artist_id failed: %s", e)
return best, has_genres, spotify_artist_id
except Exception:
return None, False, None