Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some more error annotations #252

Merged
merged 1 commit into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chain/state/statetree.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (st *StateTree) GetActor(addr address.Address) (*types.Actor, error) {
if err == hamt.ErrNotFound {
return nil, types.ErrActorNotFound
}
return nil, err
return nil, xerrors.Errorf("hamt find failed: %w", err)
}

st.actorcache[addr] = &act
Expand Down
5 changes: 3 additions & 2 deletions chain/stmgr/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package stmgr
import (
"context"
"fmt"

"github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/chain/vm"
Expand All @@ -29,7 +30,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate

fromActor, err := vmi.StateTree().GetActor(msg.From)
if err != nil {
return nil, err
return nil, xerrors.Errorf("call raw get actor: %s", err)
}

msg.Nonce = fromActor.Nonce
Expand All @@ -54,7 +55,7 @@ func (sm *StateManager) Call(ctx context.Context, msg *types.Message, ts *types.

state, err := sm.TipSetState(ts.Cids())
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)
Expand Down
7 changes: 4 additions & 3 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"crypto/sha256"
"encoding/json"
"fmt"
"github.com/filecoin-project/go-lotus/build"
"sync"

"github.com/filecoin-project/go-lotus/build"

amt "github.com/filecoin-project/go-amt-ipld"
"github.com/filecoin-project/go-lotus/chain/types"

Expand Down Expand Up @@ -97,7 +98,7 @@ func (cs *ChainStore) Load() error {

ts, err := cs.LoadTipSet(tscids)
if err != nil {
return err
return xerrors.Errorf("loading tipset: %w", err)
}

cs.heaviest = ts
Expand Down Expand Up @@ -262,7 +263,7 @@ func (cs *ChainStore) LoadTipSet(cids []cid.Cid) (*types.TipSet, error) {
for _, c := range cids {
b, err := cs.GetBlock(c)
if err != nil {
return nil, err
return nil, xerrors.Errorf("get block %s: %w", c, err)
}

blks = append(blks, b)
Expand Down