From 7ffd87a5ac6312011e87c5042df59b3cd13724b9 Mon Sep 17 00:00:00 2001 From: phuonganhniie Date: Thu, 4 May 2023 18:18:48 +0700 Subject: [PATCH] fix: return errors instead of error variable --- spt/auth.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spt/auth.go b/spt/auth.go index cbd8639..3ab3ecc 100644 --- a/spt/auth.go +++ b/spt/auth.go @@ -53,6 +53,12 @@ type payload struct { } func InitClient() error { + clientID := os.Getenv("SPOTIFY_ID") + clientSecret := os.Getenv("SPOTIFY_SECRET") + if clientID == "" || clientSecret == "" { + return errors.New("SPOTIFY_ID and/or SPOTIFY_SECRET are missing. Please make sure you have set the SPOTIFY_ID and SPOTIFY_SECRET environment variables") + } + token := &oauth2.Token{} // shouldn't be nil if the file doesn't exist.