From ef8f38fc5294f56f01425281bbf1528af8eb5725 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Fri, 27 Oct 2023 00:01:49 +0200 Subject: [PATCH] fix: :bug: fix false error handling of mongo.ErrNoDocuments --- users/service.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/users/service.go b/users/service.go index 788166d..5201dac 100644 --- a/users/service.go +++ b/users/service.go @@ -2,6 +2,7 @@ package users import ( "context" + "errors" "fmt" "time" @@ -77,7 +78,7 @@ func SaveUserToken(ctx context.Context, app *core.App, spotifyID string, token * coll := app.MongoClient.Database("listy").Collection("users") 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) }