From 0a109bc886a0b69824c26ea84358576fbc872d85 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 10 Jan 2026 16:04:43 +0100 Subject: [PATCH] Fix handling and logging of thumbnail save failures --- src/librarypanel.py | 4 ++-- src/utils.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/librarypanel.py b/src/librarypanel.py index 83cafe2..22a8b43 100644 --- a/src/librarypanel.py +++ b/src/librarypanel.py @@ -341,8 +341,8 @@ class LibraryPanel(Adw.Bin): except client.CommandException: # Exception is handled by client pass - except Exception as e: - self._logger.exception("Failed to load albumart", e) + except Exception: + self._logger.exception("Failed to load albumart") if pixbuf is None: icon = self._get_default_icon(self._item_size, self._item_size) grid_item.set_icon(icon) diff --git a/src/utils.py b/src/utils.py index 89b33af..4b58fb9 100644 --- a/src/utils.py +++ b/src/utils.py @@ -3,6 +3,7 @@ import gi import hashlib import locale +import logging import os gi.require_version('Gtk', '4.0') @@ -37,7 +38,12 @@ class Utils: if pixbuf is not None: pixbuf = pixbuf.scale_simple(size, size, GdkPixbuf.InterpType.HYPER) - pixbuf.savev(cache_url, 'jpeg', [], []) + try: + pixbuf.savev(cache_url, 'jpeg', [], []) + except Exception as e: + logger = logging.getLogger(__name__) + logger.warning("Failed to save thumbnail for album\"%s\": " + "%s", album.get_title(), e) return pixbuf @staticmethod