mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
Remvoe errors package from libs (#4157)
*libs/common/errors: remove package - remove errors file from cmn pkg - use errorf instead of wrap in async function - add changelog entry - closes #3862
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
lerr "github.com/tendermint/tendermint/lite/errors"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
@@ -46,13 +45,13 @@ func (bv *BaseVerifier) Verify(signedHeader types.SignedHeader) error {
|
||||
|
||||
// We can't verify commits for a different chain.
|
||||
if signedHeader.ChainID != bv.chainID {
|
||||
return cmn.NewError("BaseVerifier chainID is %v, cannot verify chainID %v",
|
||||
return errors.Errorf("BaseVerifier chainID is %v, cannot verify chainID %v",
|
||||
bv.chainID, signedHeader.ChainID)
|
||||
}
|
||||
|
||||
// We can't verify commits older than bv.height.
|
||||
if signedHeader.Height < bv.height {
|
||||
return cmn.NewError("BaseVerifier height is %v, cannot verify height %v",
|
||||
return errors.Errorf("BaseVerifier height is %v, cannot verify height %v",
|
||||
bv.height, signedHeader.Height)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ func GetWithProof(prt *merkle.ProofRuntime, key []byte, reqHeight int64, node rp
|
||||
val cmn.HexBytes, height int64, proof *merkle.Proof, err error) {
|
||||
|
||||
if reqHeight < 0 {
|
||||
err = cmn.NewError("Height cannot be negative")
|
||||
err = errors.New("Height cannot be negative")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func GetWithProofOptions(prt *merkle.ProofRuntime, path string, key []byte, opts
|
||||
|
||||
// Validate the response, e.g. height.
|
||||
if resp.IsErr() {
|
||||
err = cmn.NewError("Query error for key %d: %d", key, resp.Code)
|
||||
err = errors.Errorf("Query error for key %d: %d", key, resp.Code)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func GetWithProofOptions(prt *merkle.ProofRuntime, path string, key []byte, opts
|
||||
return nil, lerr.ErrEmptyTree()
|
||||
}
|
||||
if resp.Height == 0 {
|
||||
return nil, cmn.NewError("Height returned is zero")
|
||||
return nil, errors.New("Height returned is zero")
|
||||
}
|
||||
|
||||
// AppHash for height H is in header H+1
|
||||
|
||||
Reference in New Issue
Block a user