Skip to content

Commit

Permalink
kv: fix improperly wrapped errors
Browse files Browse the repository at this point in the history
I'm working on a linter that detects errors that are not wrapped
correctly, and it discovered these.

Release note: None
  • Loading branch information
rafiss committed Nov 2, 2021
1 parent ce622df commit 5d84e46
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ func skipStaleReplicas(
if !routing.Valid() {
return noMoreReplicasErr(
ambiguousError,
errors.Newf("routing information detected to be stale; lastErr: %s", lastErr))
errors.Wrap(lastErr, "routing information detected to be stale"))
}

for {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/txn_coord_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func verifyCleanup(key roachpb.Key, eng storage.Engine, t *testing.T, coords ...
//lint:ignore SA1019 historical usage of deprecated eng.MVCCGetProto is OK
ok, _, _, err := eng.MVCCGetProto(storage.MakeMVCCMetadataKey(key), meta)
if err != nil {
return fmt.Errorf("error getting MVCC metadata: %s", err)
return errors.Wrap(err, "error getting MVCC metadata")
}
if ok && meta.Txn != nil {
return fmt.Errorf("found unexpected write intent: %s", meta)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5017,7 +5017,7 @@ func setupClusterWithSubsumedRange(
newDesc, err = tc.AddVoters(desc.StartKey.AsRawKey(), tc.Target(1))
if kv.IsExpectedRelocateError(err) {
// Retry.
return errors.Newf("ChangeReplicas: received error %s", err)
return errors.Wrap(err, "ChangeReplicas received error")
}
return nil
})
Expand Down

0 comments on commit 5d84e46

Please sign in to comment.