Change formatting, stringify errors before returning over JSONRPC
This commit is contained in:
parent
02b0c8dd94
commit
8f56814ffb
@ -400,8 +400,8 @@ func testRetrieval(t *testing.T, ctx context.Context, err error, client *impl.Fu
|
|||||||
}
|
}
|
||||||
updates, err := client.ClientRetrieve(ctx, offers[0].Order(caddr), ref)
|
updates, err := client.ClientRetrieve(ctx, offers[0].Order(caddr), ref)
|
||||||
for update := range updates {
|
for update := range updates {
|
||||||
if update.Err != nil {
|
if update.Err != "" {
|
||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,12 +846,11 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case evt, chOpen := <-updates:
|
case evt, chOpen := <-updates:
|
||||||
|
fmt.Printf("> Recv: %s, Paid %s, %s (%s)\n",
|
||||||
fmt.Printf("Retrieval Event: %s, State: %s, BytesReceived: %d, PaymentSent: %s\n",
|
types.SizeStr(types.NewInt(evt.BytesReceived)),
|
||||||
|
types.FIL(evt.FundsSpent),
|
||||||
retrievalmarket.ClientEvents[evt.Event],
|
retrievalmarket.ClientEvents[evt.Event],
|
||||||
retrievalmarket.DealStatuses[evt.Status],
|
retrievalmarket.DealStatuses[evt.Status],
|
||||||
evt.BytesReceived,
|
|
||||||
evt.FundsSpent.String(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if !chOpen {
|
if !chOpen {
|
||||||
@ -859,8 +858,8 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if evt.Err != nil {
|
if evt.Err != "" {
|
||||||
return xerrors.Errorf("retrieval failed: %w", err)
|
return xerrors.Errorf("retrieval failed: %v", err)
|
||||||
}
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return xerrors.Errorf("retrieval timed out")
|
return xerrors.Errorf("retrieval timed out")
|
||||||
|
@ -34,5 +34,5 @@ type RetrievalEvent struct {
|
|||||||
Status retrievalmarket.DealStatus
|
Status retrievalmarket.DealStatus
|
||||||
BytesReceived uint64
|
BytesReceived uint64
|
||||||
FundsSpent abi.TokenAmount
|
FundsSpent abi.TokenAmount
|
||||||
Err error
|
Err string
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,11 @@ func (a *API) clientRetrieve(ctx context.Context, order api.RetrievalOrder, ref
|
|||||||
defer close(events)
|
defer close(events)
|
||||||
|
|
||||||
finish := func(e error) {
|
finish := func(e error) {
|
||||||
events <- marketevents.RetrievalEvent{Err: e}
|
errStr := ""
|
||||||
|
if e != nil {
|
||||||
|
errStr = e.Error()
|
||||||
|
}
|
||||||
|
events <- marketevents.RetrievalEvent{Err: errStr}
|
||||||
}
|
}
|
||||||
|
|
||||||
if order.MinerPeer.ID == "" {
|
if order.MinerPeer.ID == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user