feat: return 500 on auth errors
continuous-integration/drone/push Build is passing Details

main
RaviAnand Mohabir 11 months ago
parent dd5820fe44
commit e73da1d4fe

@ -49,9 +49,9 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) {
// use the same state string here that you used to generate the URL
token, err := app.SpotifyAuth.Token(r.Context(), state.(string), r)
if err != nil {
if err != nil || token == nil {
fmt.Println(err)
http.Error(w, "Couldn't get token", http.StatusNotFound)
http.Error(w, "Couldn't get token", http.StatusInternalServerError)
return
}
@ -61,7 +61,7 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) {
if err != nil {
fmt.Println(err)
http.Error(w, "Couldn't get current user", http.StatusNotFound)
http.Error(w, "Couldn't get current user", http.StatusInternalServerError)
return
}
@ -69,7 +69,7 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) {
if err != nil {
fmt.Println(err)
http.Error(w, "Couldn't save token", http.StatusNotFound)
http.Error(w, "Couldn't save token", http.StatusInternalServerError)
return
}

Loading…
Cancel
Save