fix: 🐛 fix false error handling of mongo.ErrNoDocuments
continuous-integration/drone/push Build is passing Details

main
RaviAnand Mohabir 1 year ago
parent ca8805a6bc
commit ef8f38fc52

@ -2,6 +2,7 @@ package users
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"time" "time"
@ -77,7 +78,7 @@ func SaveUserToken(ctx context.Context, app *core.App, spotifyID string, token *
coll := app.MongoClient.Database("listy").Collection("users") coll := app.MongoClient.Database("listy").Collection("users")
result, err := GetUser(ctx, app, spotifyID) result, err := GetUser(ctx, app, spotifyID)
if err != nil && err != mongo.ErrNoDocuments { if err != nil && !errors.Is(mongo.ErrNoDocuments, err) {
return nil, fmt.Errorf("couldn't fetch user %v", err) return nil, fmt.Errorf("couldn't fetch user %v", err)
} }

Loading…
Cancel
Save