diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 705209de5..24461194c 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -217,6 +217,9 @@ class SpotifyPlugin(MetadataSourcePlugin, BeetsPlugin): elif e.response.status_code == 503: self._log.error("Service Unavailable.") raise SpotifyAPIError("Service Unavailable.") + elif e.response.status_code == 502: + self._log.error("Bad Gateway.") + raise SpotifyAPIError("Bad Gateway.") elif e.response is not None: raise SpotifyAPIError( f"{self.data_source} API error:\n{e.response.text}\n" diff --git a/docs/changelog.rst b/docs/changelog.rst index e573c6d52..8266e8550 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -150,6 +150,7 @@ Bug fixes: * :doc:`/plugins/deezer`: Improve Deezer plugin error handling and set requests timeout to 10 seconds. :bug:`4983` +* :doc:`/plugins/spotify`: Add bad gateway (502) error handling. * :doc:`/plugins/spotify`: Add a limit of 3 retries, instead of retrying endlessly when the API is not available. * Fix a crash when the Spotify API timeouts or does not return a `Retry-After` interval. :bug:`4942`