Skip to content

Commit

Permalink
use errors.Is instead of ==
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrks committed Jan 9, 2024
1 parent 33b2154 commit f43edba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions db/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package db
import (
"bytes"
"context"
"errors"
"fmt"
"math"
"net/http"
Expand All @@ -21,7 +22,7 @@ import (
"github.com/couchbase/sync_gateway/auth"
"github.com/couchbase/sync_gateway/base"
"github.com/couchbase/sync_gateway/channels"
"github.com/pkg/errors"
pkgerrors "github.com/pkg/errors"
)

const (
Expand Down Expand Up @@ -699,7 +700,7 @@ func (db *DatabaseCollectionWithUser) get1xRevFromDoc(ctx context.Context, doc *
// Update: this applies to non-deletions too, since the client may have lost access to
// the channel and gotten a "removed" entry in the _changes feed. It then needs to
// incorporate that tombstone and for that it needs to see the _revisions property.
if revid == "" || doc.History[revid] == nil || err == ErrMissing {
if revid == "" || doc.History[revid] == nil || errors.Is(err, ErrMissing) {
return nil, false, err
}
if doc.History[revid].Deleted {
Expand Down Expand Up @@ -1722,7 +1723,7 @@ func (db *DatabaseCollectionWithUser) addAttachments(ctx context.Context, newAtt
if errors.Is(err, ErrAttachmentTooLarge) || err.Error() == "document value was too large" {
err = base.HTTPErrorf(http.StatusRequestEntityTooLarge, "Attachment too large")
} else {
err = errors.Wrap(err, "Error adding attachment")
err = pkgerrors.Wrap(err, "Error adding attachment")
}
}
return err
Expand Down

0 comments on commit f43edba

Please sign in to comment.