Merge pull request #252 from filecoin-project/feat/error-annotations

Add some more error annotations
This commit is contained in:
Łukasz Magiera 2019-09-30 18:02:07 -06:00 committed by GitHub
commit 3c0c3d7cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -108,7 +108,7 @@ func (st *StateTree) GetActor(addr address.Address) (*types.Actor, error) {
if err == hamt.ErrNotFound { if err == hamt.ErrNotFound {
return nil, types.ErrActorNotFound return nil, types.ErrActorNotFound
} }
return nil, err return nil, xerrors.Errorf("hamt find failed: %w", err)
} }
st.actorcache[addr] = &act st.actorcache[addr] = &act

View File

@ -3,6 +3,7 @@ package stmgr
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/filecoin-project/go-lotus/chain/actors" "github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/types" "github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/chain/vm" "github.com/filecoin-project/go-lotus/chain/vm"
@ -29,7 +30,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
fromActor, err := vmi.StateTree().GetActor(msg.From) fromActor, err := vmi.StateTree().GetActor(msg.From)
if err != nil { if err != nil {
return nil, err return nil, xerrors.Errorf("call raw get actor: %s", err)
} }
msg.Nonce = fromActor.Nonce msg.Nonce = fromActor.Nonce
@ -54,7 +55,7 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.
state, err := sm.TipSetState(ts.Cids()) state, err := sm.TipSetState(ts.Cids())
if err != nil { if err != nil {
return nil, err return nil, xerrors.Errorf("getting tipset state: %w", err)
} }
r := vm.NewChainRand(sm.cs, ts.Cids(), ts.Height(), nil) r := vm.NewChainRand(sm.cs, ts.Cids(), ts.Height(), nil)

View File

@ -5,9 +5,10 @@ import (
"crypto/sha256" "crypto/sha256"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/filecoin-project/go-lotus/build"
"sync" "sync"
"github.com/filecoin-project/go-lotus/build"
amt "github.com/filecoin-project/go-amt-ipld" amt "github.com/filecoin-project/go-amt-ipld"
"github.com/filecoin-project/go-lotus/chain/types" "github.com/filecoin-project/go-lotus/chain/types"
@ -97,7 +98,7 @@ func (cs *ChainStore) Load() error {
ts, err := cs.LoadTipSet(tscids) ts, err := cs.LoadTipSet(tscids)
if err != nil { if err != nil {
return err return xerrors.Errorf("loading tipset: %w", err)
} }
cs.heaviest = ts cs.heaviest = ts
@ -262,7 +263,7 @@ func (cs *ChainStore) LoadTipSet(cids []cid.Cid) (*types.TipSet, error) {
for _, c := range cids { for _, c := range cids {
b, err := cs.GetBlock(c) b, err := cs.GetBlock(c)
if err != nil { if err != nil {
return nil, err return nil, xerrors.Errorf("get block %s: %w", c, err)
} }
blks = append(blks, b) blks = append(blks, b)