refactor: replace error-handling code for potential wrapped errors (#20214)
This commit is contained in:
parent
0a2481d9e4
commit
8a36d9d3d0
@ -13,6 +13,7 @@ import (
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"testing"
|
||||
)
|
||||
@ -93,7 +94,7 @@ func TestInvalidRecoveryID(t *testing.T) {
|
||||
sig, _ := Sign(msg, seckey)
|
||||
sig[64] = 99
|
||||
_, err := RecoverPubkey(msg, sig)
|
||||
if err != ErrInvalidRecoveryID {
|
||||
if !errors.Is(err, ErrInvalidRecoveryID) {
|
||||
t.Fatalf("got %q, want %q", err, ErrInvalidRecoveryID)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package orm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@ -10,7 +11,7 @@ import (
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
"cosmossdk.io/x/group/errors"
|
||||
grouperrors "cosmossdk.io/x/group/errors"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/address"
|
||||
@ -70,7 +71,7 @@ func TestCreate(t *testing.T) {
|
||||
Id: 1,
|
||||
Name: "some name",
|
||||
},
|
||||
expErr: errors.ErrORMEmptyKey,
|
||||
expErr: grouperrors.ErrORMEmptyKey,
|
||||
},
|
||||
"happy path": {
|
||||
rowID: EncodeSequence(1),
|
||||
@ -231,7 +232,7 @@ func TestDelete(t *testing.T) {
|
||||
|
||||
// then
|
||||
var loaded testdata.TableModel
|
||||
if spec.expErr == sdkerrors.ErrNotFound {
|
||||
if errors.Is(spec.expErr, sdkerrors.ErrNotFound) {
|
||||
require.NoError(t, myTable.GetOne(store, EncodeSequence(1), &loaded))
|
||||
assert.Equal(t, initValue, loaded)
|
||||
} else {
|
||||
|
||||
@ -30,7 +30,8 @@ func DownloadUpgrade(dstRoot, url, daemonName string) error {
|
||||
// First try to download it as a single file. If there's no error, it's okay and we're done.
|
||||
if err := getFile(url, target); err != nil {
|
||||
// If it was a checksum error, no need to try as directory.
|
||||
if _, ok := err.(*getter.ChecksumError); ok {
|
||||
var checksumError *getter.ChecksumError
|
||||
if errors.As(err, &checksumError) {
|
||||
return err
|
||||
}
|
||||
// File download didn't work, try it as an archive.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user