From 753e4e9a3984a529023fe30ae763f007d6e6e6dc Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Tue, 28 Nov 2023 09:58:42 -0500 Subject: [PATCH 1/2] Add 502 error handling --- beetsplug/spotify.py | 3 +++ 1 file changed, 3 insertions(+) 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" From 51c017ab6ff5fd39ace8feebf6521189aa916321 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Tue, 28 Nov 2023 10:04:04 -0500 Subject: [PATCH 2/2] Update changelog.rst --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1ff5b59c8..73c34bfa4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -148,6 +148,7 @@ New features: Bug fixes: +* :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`