fix: verify token on --auth and broaden startup exception catch

This commit is contained in:
2026-05-22 22:35:25 +02:00
parent f2ac843759
commit 0d3b274aaa

View File

@@ -162,13 +162,14 @@ async def _run_server() -> None:
if __name__ == "__main__":
if "--auth" in sys.argv:
print("Authenticating with Spotify (a browser window will open)...")
spotify_client.get_client()
sp = spotify_client.get_client()
sp.current_user() # verify the token actually works
print("Authentication successful! Token cached.")
sys.exit(0)
try:
spotify_client.get_client()
except RuntimeError as e:
except Exception as e:
print(f"Startup error: {e}", file=sys.stderr)
sys.exit(1)