diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 86af9da06..d63aef8ae 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -90,6 +90,9 @@ class DiscogsPlugin(BeetsPlugin): token, secret = auth_client.get_access_token(code) except DiscogsAPIError: raise beets.ui.UserError('Discogs authorization failed') + except (ConnectionError, socket.error) as e: + self._log.debug(u'connection error: {0}', e) + raise beets.ui.UserError('communication with Discogs failed') # Save the token for later use. self._log.debug('Discogs token {0}, secret {1}', token, secret) @@ -122,7 +125,7 @@ class DiscogsPlugin(BeetsPlugin): except DiscogsAPIError as e: self._log.debug(u'API Error: {0} (query: {1})', e, query) return [] - except ConnectionError as e: + except (ConnectionError, socket.error) as e: self._log.debug(u'HTTP Connection Error: {0}', e) return [] diff --git a/docs/changelog.rst b/docs/changelog.rst index ba5934c4c..9be8779ea 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -96,6 +96,8 @@ Fixes: * :doc:`/plugins/scrub`: Log an error instead of stopping when the ``beet scrub`` command cannot write a file. Also, avoid problems on Windows with Unicode filenames. :bug:`1297` +* :doc:`/plugins/discogs`: Handle and log more kinds of communication + errors. :bug:`1299` For developers: