binance: add details to order cancel error

This commit is contained in:
c9s 2022-01-11 16:35:49 +08:00
parent 31461f1720
commit 96ffab9cd8

View File

@ -546,9 +546,9 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
req.OrderID(int64(o.OrderID)) req.OrderID(int64(o.OrderID))
} }
_, _err := req.Do(ctx) _, err2 := req.Do(ctx)
if _err != nil { if err2 != nil {
err = multierr.Append(err, _err) err = multierr.Append(err, err2)
} }
} }
@ -569,9 +569,14 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
_, err2 := req.Do(ctx) _, err2 := req.Do(ctx)
if err2 != nil { if err2 != nil {
err = multierr.Append(err, err2) err = multierr.Append(err, errors.Wrapf(
err2, "can not cancel %s order. orderID: %d clientOrderID: %s",
o.Symbol,
o.OrderID,
o.ClientOrderID))
} }
} else { } else {
// SPOT
var req = e.Client.NewCancelOrderService() var req = e.Client.NewCancelOrderService()
req.Symbol(o.Symbol) req.Symbol(o.Symbol)
@ -583,7 +588,11 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
_, err2 := req.Do(ctx) _, err2 := req.Do(ctx)
if err2 != nil { if err2 != nil {
err = multierr.Append(err, err2) err = multierr.Append(err, errors.Wrapf(
err2, "can not cancel %s order. orderID: %d clientOrderID: %s",
o.Symbol,
o.OrderID,
o.ClientOrderID))
} }
} }
} }