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

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

Loading…
Cancel
Save