Improve error messages in case of unexpected response from the API
Is your feature request related to a problem? Please describe.
When a problem happens on the API side (network error, rate limiting, version not found...) a generic message unexpected value returned by API is displayed by tenv which does not indicate the nature of the problem and could make the investigation more complicated.
Describe the solution you'd like Clear error messages, for example:
- Version not available:
$ tenv tf install 1.42.0 Installing Terraform 1.42.0 Fetching release information from https://releases.hashicorp.com/terraform/1.42.0/index.json error: API returned 404 Not Found, version may not be available - Rate limiting from GitHub:
$ tenv tg install latest Fetching all releases information from https://api.github.com/repos/gruntwork-io/terragrunt/releases error: API returned 429 Too Many Requests, you are rate limited by GitHub, consider using a token with the TENV_GITHUB_TOKEN environment variable
Describe alternatives you've considered As a quick first attempt this kind of errors could be displayed only in verbose mode before implementing human-readable error messages.
Good idea, I will take a look on what could be done
@dvaumoron Denis, you don't mind if I will check it? I've already started working on it a bit, and plan to proceed on weekends :)
@Nmishin , have you made progress on this improvement ?
@dvaumoron yes, I have something, will send it to review tomorrow
Partially done with #288
done in https://github.com/tofuutils/tenv/pull/289