Merge pull request #9326 from filecoin-project/asr/deal-info-logs
feat: add descriptive errors to markets event handler
This commit is contained in:
commit
10087ffaeb
@ -554,7 +554,7 @@ func (me *messageEvents) Called(ctx context.Context, check CheckFunc, msgHnd Msg
|
||||
|
||||
id, err := me.hcAPI.onHeadChanged(ctx, check, hnd, rev, confidence, timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("on head changed error: %w", err)
|
||||
}
|
||||
|
||||
me.lk.Lock()
|
||||
|
@ -72,7 +72,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
// Note: the error returned from here will end up being returned
|
||||
// from OnDealSectorPreCommitted so no need to call the callback
|
||||
// with the error
|
||||
return false, false, err
|
||||
return false, false, xerrors.Errorf("failed to check deal activity: %w", err)
|
||||
}
|
||||
|
||||
if isActive {
|
||||
@ -89,7 +89,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
|
||||
diff, err := mgr.dpc.diffPreCommits(ctx, provider, dealInfo.PublishMsgTipSet, ts.Key())
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
return false, false, xerrors.Errorf("failed to diff precommits: %w", err)
|
||||
}
|
||||
|
||||
for _, info := range diff.Added {
|
||||
@ -139,7 +139,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
// current deal ID from the publish message CID
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key(), &proposal, publishCid)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, xerrors.Errorf("failed to get dealinfo: %w", err)
|
||||
}
|
||||
|
||||
// If this is a replica update method that succeeded the deal is active
|
||||
@ -159,7 +159,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
// Extract the message parameters
|
||||
sn, err := dealSectorInPreCommitMsg(msg, res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, xerrors.Errorf("failed to extract message params: %w", err)
|
||||
}
|
||||
|
||||
if sn != nil {
|
||||
|
@ -145,7 +145,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
"error getting current deal info in check func": {
|
||||
currentDealInfoErr: errors.New("something went wrong"),
|
||||
expectedCBCallCount: 0,
|
||||
expectedError: xerrors.Errorf("failed to set up called handler: failed to look up deal on chain: something went wrong"),
|
||||
expectedError: xerrors.Errorf("failed to set up called handler: failed to check deal activity: failed to look up deal on chain: something went wrong"),
|
||||
},
|
||||
"sector already active": {
|
||||
currentDealInfo: pipeline.CurrentDealInfo{
|
||||
@ -162,7 +162,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
PublishMsgTipSet: types.EmptyTSK,
|
||||
},
|
||||
expectedCBCallCount: 0,
|
||||
expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch),
|
||||
expectedError: xerrors.Errorf("failed to set up called handler: failed to check deal activity: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch),
|
||||
},
|
||||
"error getting current deal info in called func": {
|
||||
currentDealInfo: pipeline.CurrentDealInfo{
|
||||
@ -180,7 +180,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedCBCallCount: 1,
|
||||
expectedCBError: errors.New("handling applied event: something went wrong"),
|
||||
expectedCBError: errors.New("handling applied event: failed to get dealinfo: something went wrong"),
|
||||
},
|
||||
"proposed deal epoch timeout": {
|
||||
currentDealInfo: pipeline.CurrentDealInfo{
|
||||
|
Loading…
Reference in New Issue
Block a user