fix: verify token on --auth and broaden startup exception catch
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user