This commit is contained in:
@@ -1470,8 +1470,10 @@ class Session(Closeable, MessageListener, SubListener):
|
|||||||
)
|
)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# All attempts failed: log and raise a clear, user-friendly
|
# All attempts failed: log a clear, user-friendly error and
|
||||||
# error instead of crashing with a low-level struct.error.
|
# terminate the process without a traceback. This prevents
|
||||||
|
# callers (like Zotify) from incorrectly retrying OAuth when
|
||||||
|
# the failure is purely network-related.
|
||||||
friendly_message = (
|
friendly_message = (
|
||||||
"Failed to connect to Spotify after "
|
"Failed to connect to Spotify after "
|
||||||
f"{max_attempts} attempts. "
|
f"{max_attempts} attempts. "
|
||||||
@@ -1480,8 +1482,9 @@ class Session(Closeable, MessageListener, SubListener):
|
|||||||
"This is usually a network or firewall issue."
|
"This is usually a network or firewall issue."
|
||||||
)
|
)
|
||||||
self.logger.error("%s Last error: %s", friendly_message, last_exc)
|
self.logger.error("%s Last error: %s", friendly_message, last_exc)
|
||||||
print(friendly_message)
|
# Exit with a non-zero status but no stack trace; the
|
||||||
raise RuntimeError(friendly_message) from last_exc
|
# logger message above provides the user-facing explanation.
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
def content_feeder(self) -> PlayableContentFeeder:
|
def content_feeder(self) -> PlayableContentFeeder:
|
||||||
""" """
|
""" """
|
||||||
|
|||||||
Reference in New Issue
Block a user