Compare commits

..

6 commits

View file

@ -89,7 +89,7 @@ func (c *Client) tryGetRate(ctx context.Context, fromCode, toCode string) (RateD
if resp.StatusCode() != 200 {
switch resp.StatusCode() {
case 400:
return RateDTO{}, fmt.Errorf("%w: %s", ErrInvalidConvert, toCode)
return RateDTO{}, ErrInvalidConvert // Invalid convert parameter
case 401:
return RateDTO{}, fmt.Errorf("%w: unauthorized - bad or missing API key", ErrAPIError)
default:
@ -99,7 +99,7 @@ func (c *Client) tryGetRate(ctx context.Context, fromCode, toCode string) (RateD
// Check if data is empty - invalid currency
if len(response.Data) == 0 {
return RateDTO{}, fmt.Errorf("%w: %s", ErrUnknownSymbol, fromCode)
return RateDTO{}, ErrUnknownSymbol
}
// Extract rate from response