From 7c9da0e958470708d9d84bb37d80cdb6d47b88a6 Mon Sep 17 00:00:00 2001 From: Leonardo Araujo Date: Sun, 20 Oct 2024 15:35:52 -0300 Subject: [PATCH] improve error response --- pkg/coinapi/coinapi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/coinapi/coinapi.go b/pkg/coinapi/coinapi.go index f293a3e..4f69c77 100644 --- a/pkg/coinapi/coinapi.go +++ b/pkg/coinapi/coinapi.go @@ -52,7 +52,7 @@ func FetchRate(currency string) (float64, error) { url := BASE_URL + "exchangerate/BTC/" + currency response, err := makeRequest(url) if err != nil { - return 0, fmt.Errorf("error fetching currency %s: %w", currency, err) + return 0, fmt.Errorf("error fetching rate for currency %s: %w", currency, err) } var message responses.CurrencyRate @@ -72,7 +72,7 @@ func FetchDailyVariation(currency string) (float64, error) { response, err := makeRequest(url) if err != nil { - return 0, err + return 0, fmt.Errorf("error daily variation for currency %s: %w", currency, err) } if len(response) == 0 {