Skip to content

Commit 0430bd3

Browse files
committed
discogs: don't crash if a release is deleted
1 parent 5beb3d1 commit 0430bd3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

beetsplug/discogs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,14 @@ def get_album_info(self, result):
305305
# Explicitly reload the `Release` fields, as they might not be yet
306306
# present if the result is from a `discogs_client.search()`.
307307
if not result.data.get("artists"):
308-
result.refresh()
308+
try:
309+
result.refresh()
310+
except CONNECTION_ERRORS:
311+
self._log.debug(
312+
"Connection error in release lookup: {0}",
313+
result,
314+
)
315+
return None
309316

310317
# Sanity check for required fields. The list of required fields is
311318
# defined at Guideline 1.3.1.a, but in practice some releases might be

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Bug fixes:
5555
e.g. non latin characters as 盗作. If you want to keep the legacy behavior
5656
set the config option ``spotify.search_query_ascii: yes``.
5757
:bug:`5699`
58+
* :doc:`plugins/discogs`: Beets will no longer crash if a release has been
59+
deleted, and returns a 404.
5860

5961
For packagers:
6062

0 commit comments

Comments
 (0)