From 460d1be5a1ff6ff8ffe90ed4450d0d9a49addf75 Mon Sep 17 00:00:00 2001 From: martonp Date: Tue, 3 Dec 2024 17:42:41 +0100 Subject: [PATCH] libxc/binance: Better error message Return the actual error message in the error so it prints properly on the UI. --- client/mm/libxc/binance.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/mm/libxc/binance.go b/client/mm/libxc/binance.go index 28f1552a21..9336b3fde9 100644 --- a/client/mm/libxc/binance.go +++ b/client/mm/libxc/binance.go @@ -1330,8 +1330,12 @@ func (bnc *binance) request(ctx context.Context, method, endpoint string, query, } if err := dexnet.Do(req, thing, dexnet.WithSizeLimit(1<<24), dexnet.WithErrorParsing(&errPayload)); err != nil { bnc.log.Errorf("request error from endpoint %s %q with query = %q, body = %q", method, endpoint, queryString, bodyString) - return fmt.Errorf("%w, bn code = %d, msg = %q", err, errPayload.Code, errPayload.Msg) + if errPayload.Msg != "" { + return fmt.Errorf("Binance error: %v", errPayload.Msg) + } + return err } + return nil }