fix: return errors instead of error variable

This commit is contained in:
phuonganhniie
2023-05-04 18:18:48 +07:00
parent 469ef337f8
commit 7ffd87a5ac

View File

@@ -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.