From c933b888cbffbaa362de0928a138f67c6eacbad5 Mon Sep 17 00:00:00 2001 From: Adam French Date: Sun, 23 Nov 2025 21:35:42 +0000 Subject: [PATCH] added error handling --- backend/handlers/handle_spotify.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/handlers/handle_spotify.go b/backend/handlers/handle_spotify.go index 07c2db1..8f9d97d 100644 --- a/backend/handlers/handle_spotify.go +++ b/backend/handlers/handle_spotify.go @@ -34,6 +34,11 @@ func (store *Store) CompleteAuth(c *gin.Context) { func (store *Store) ListeningTo(c *gin.Context) { ctx := c.Request.Context() + if store.SpotifyClient == nil { + c.JSON(500, gin.H{"error": "Spotify not authenticated"}) + return + } + playing, err := store.SpotifyClient.PlayerCurrentlyPlaying(ctx) if err != nil { c.JSON(500, gin.H{"error": err.Error()})