consider response status and err
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
parent
4d0df5d599
commit
35d9de6b6e
@ -461,6 +461,9 @@ var clientRetrieveCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
}
|
||||
if offer.Err != "" {
|
||||
return fmt.Errorf("The received offer errored: %s", offer.Err)
|
||||
}
|
||||
|
||||
ref := &lapi.FileRef{
|
||||
Path: cctx.Args().Get(1),
|
||||
|
@ -224,6 +224,15 @@ func (a *API) makeRetrievalQuery(ctx context.Context, rp retrievalmarket.Retriev
|
||||
if err != nil {
|
||||
return api.QueryOffer{Err: err.Error(), Miner: rp.Address, MinerPeerID: rp.ID}
|
||||
}
|
||||
var errStr string
|
||||
switch queryResponse.Status {
|
||||
case retrievalmarket.QueryResponseAvailable:
|
||||
errStr = ""
|
||||
case retrievalmarket.QueryResponseUnavailable:
|
||||
errStr = "retrieval query offer was unavailable"
|
||||
case retrievalmarket.QueryResponseError:
|
||||
errStr = "retrieval query offer errored"
|
||||
}
|
||||
|
||||
return api.QueryOffer{
|
||||
Root: payload,
|
||||
@ -233,6 +242,7 @@ func (a *API) makeRetrievalQuery(ctx context.Context, rp retrievalmarket.Retriev
|
||||
PaymentIntervalIncrease: queryResponse.MaxPaymentIntervalIncrease,
|
||||
Miner: queryResponse.PaymentAddress, // TODO: check
|
||||
MinerPeerID: rp.ID,
|
||||
Err: errStr,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user