From 96ffab9cd80cfed6661667c78a5f232b65ae925c Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 11 Jan 2022 16:35:49 +0800 Subject: [PATCH] binance: add details to order cancel error --- pkg/exchange/binance/exchange.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index 31c4492ab..cdb4d8b77 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -546,9 +546,9 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err req.OrderID(int64(o.OrderID)) } - _, _err := req.Do(ctx) - if _err != nil { - err = multierr.Append(err, _err) + _, err2 := req.Do(ctx) + if err2 != nil { + err = multierr.Append(err, err2) } } @@ -569,9 +569,14 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err _, err2 := req.Do(ctx) 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 { + // SPOT var req = e.Client.NewCancelOrderService() req.Symbol(o.Symbol) @@ -583,7 +588,11 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err _, err2 := req.Do(ctx) 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)) } } }