Skip to content

Commit 1c0e4cd

Browse files
committed
use errors.Is instead of ==
1 parent 25c2fab commit 1c0e4cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

db/crud.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package db
1111
import (
1212
"bytes"
1313
"context"
14+
"errors"
1415
"fmt"
1516
"math"
1617
"net/http"
@@ -21,7 +22,7 @@ import (
2122
"github.com/couchbase/sync_gateway/auth"
2223
"github.com/couchbase/sync_gateway/base"
2324
"github.com/couchbase/sync_gateway/channels"
24-
"github.com/pkg/errors"
25+
pkgerrors "github.com/pkg/errors"
2526
)
2627

2728
const (
@@ -690,7 +691,7 @@ func (db *DatabaseCollectionWithUser) get1xRevFromDoc(ctx context.Context, doc *
690691
// Update: this applies to non-deletions too, since the client may have lost access to
691692
// the channel and gotten a "removed" entry in the _changes feed. It then needs to
692693
// incorporate that tombstone and for that it needs to see the _revisions property.
693-
if revid == "" || doc.History[revid] == nil || err == ErrMissing {
694+
if revid == "" || doc.History[revid] == nil || errors.Is(err, ErrMissing) {
694695
return nil, false, err
695696
}
696697
if doc.History[revid].Deleted {
@@ -1559,7 +1560,7 @@ func (db *DatabaseCollectionWithUser) addAttachments(ctx context.Context, newAtt
15591560
if errors.Is(err, ErrAttachmentTooLarge) || err.Error() == "document value was too large" {
15601561
err = base.HTTPErrorf(http.StatusRequestEntityTooLarge, "Attachment too large")
15611562
} else {
1562-
err = errors.Wrap(err, "Error adding attachment")
1563+
err = pkgerrors.Wrap(err, "Error adding attachment")
15631564
}
15641565
}
15651566
return err

0 commit comments

Comments
 (0)