use multierror
This commit is contained in:
parent
44985722d2
commit
add113f585
@ -5,6 +5,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v1api"
|
"github.com/filecoin-project/lotus/api/v1api"
|
||||||
|
"github.com/hashicorp/go-multierror"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -135,13 +136,13 @@ func (rpn *retrievalProviderNode) GetRetrievalPricingInput(ctx context.Context,
|
|||||||
}
|
}
|
||||||
tsk := head.Key()
|
tsk := head.Key()
|
||||||
|
|
||||||
var lastErr error
|
var mErr error
|
||||||
|
|
||||||
for _, dealID := range storageDeals {
|
for _, dealID := range storageDeals {
|
||||||
ds, err := rpn.full.StateMarketStorageDeal(ctx, dealID, tsk)
|
ds, err := rpn.full.StateMarketStorageDeal(ctx, dealID, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed to look up deal %d on chain: err=%w", dealID, err)
|
log.Warnf("failed to look up deal %d on chain: err=%w", dealID, err)
|
||||||
lastErr = err
|
mErr = multierror.Append(mErr, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ds.Proposal.VerifiedDeal {
|
if ds.Proposal.VerifiedDeal {
|
||||||
@ -162,11 +163,11 @@ func (rpn *retrievalProviderNode) GetRetrievalPricingInput(ctx context.Context,
|
|||||||
// Note: The piece size can never actually be zero. We only use it to here
|
// Note: The piece size can never actually be zero. We only use it to here
|
||||||
// to assert that we didn't find a matching piece.
|
// to assert that we didn't find a matching piece.
|
||||||
if resp.PieceSize == 0 {
|
if resp.PieceSize == 0 {
|
||||||
if lastErr == nil {
|
if mErr == nil {
|
||||||
return resp, xerrors.New("failed to find matching piece")
|
return resp, xerrors.New("failed to find matching piece")
|
||||||
} else {
|
|
||||||
return resp, xerrors.Errorf("failed to fetch storage deal state: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return resp, xerrors.Errorf("failed to fetch storage deal state: %w", mErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user