Skip to content

Commit

Permalink
improve error response
Browse files Browse the repository at this point in the history
  • Loading branch information
araujo88 committed Oct 20, 2024
1 parent 17e3579 commit 7c9da0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/coinapi/coinapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 7c9da0e

Please sign in to comment.