From 058db10984a481e0fb27e4ef751a2cbfa27cc980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Rasc=C3=A3o?= Date: Mon, 17 Jan 2022 00:18:59 +0000 Subject: [PATCH] exchanges: make ErrPairNotFound an exportable error Stop erroring out when receiving execution reports from currency pairs that have not been enabled. --- exchanges/exchange.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exchanges/exchange.go b/exchanges/exchange.go index 1ca828ce..c2bae861 100644 --- a/exchanges/exchange.go +++ b/exchanges/exchange.go @@ -47,6 +47,9 @@ var ( errEndpointStringNotFound = errors.New("endpoint string not found") errTransportNotSet = errors.New("transport not set, cannot set timeout") + + // ErrPairNotFound is an error message for when unable to find a currency pair + ErrPairNotFound = errors.New("pair not found") ) func (b *Base) checkAndInitRequester() { @@ -458,7 +461,8 @@ func (b *Base) GetRequestFormattedPairAndAssetType(p string) (currency.Pair, ass } } } - return response, "", errors.New("pair not found: " + p) + return response, "", + fmt.Errorf("%s %w", p, ErrPairNotFound) } // GetAvailablePairs is a method that returns the available currency pairs