slightly improve retrieval errors
This commit is contained in:
parent
e6dd471103
commit
0b81ba118f
@ -236,7 +236,7 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := api.ClientRetrieve(ctx, offers[0].Order(payer), cctx.Args().Get(1)); err != nil {
|
if err := api.ClientRetrieve(ctx, offers[0].Order(payer), cctx.Args().Get(1)); err != nil {
|
||||||
return err
|
return xerrors.Errorf("Retrieval Failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Success")
|
fmt.Println("Success")
|
||||||
|
@ -100,7 +100,7 @@ type clientStream struct {
|
|||||||
func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64, total types.BigInt, miner peer.ID, client, minerAddr address.Address, out io.Writer) error {
|
func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64, total types.BigInt, miner peer.ID, client, minerAddr address.Address, out io.Writer) error {
|
||||||
s, err := c.h.NewStream(ctx, miner, ProtocolID)
|
s, err := c.h.NewStream(ctx, miner, ProtocolID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("failed to open stream to miner for retrieval query: %w", err)
|
||||||
}
|
}
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
@ -149,7 +149,6 @@ func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64,
|
|||||||
|
|
||||||
cst.offset += toFetch
|
cst.offset += toFetch
|
||||||
}
|
}
|
||||||
log.Info("RETRIEVE SUCCESSFUL")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,13 +172,12 @@ func (cst *clientStream) doOneExchange(ctx context.Context, toFetch uint64, out
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := cborutil.WriteCborRPC(cst.stream, deal); err != nil {
|
if err := cborutil.WriteCborRPC(cst.stream, deal); err != nil {
|
||||||
return err
|
return xerrors.Errorf("sending incremental retrieval request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp DealResponse
|
var resp DealResponse
|
||||||
if err := cborutil.ReadCborRPC(cst.peeker, &resp); err != nil {
|
if err := cborutil.ReadCborRPC(cst.peeker, &resp); err != nil {
|
||||||
log.Error(err)
|
return xerrors.Errorf("reading retrieval response: %w", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.Status != Accepted {
|
if resp.Status != Accepted {
|
||||||
|
Loading…
Reference in New Issue
Block a user