tenv icon indicating copy to clipboard operation
tenv copied to clipboard

Improve error messages in case of unexpected response from the API

Open corrieriluca opened this issue 1 year ago • 2 comments

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.

corrieriluca avatar Aug 21 '24 13:08 corrieriluca

Good idea, I will take a look on what could be done

dvaumoron avatar Aug 21 '24 17:08 dvaumoron

@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 avatar Aug 21 '24 21:08 Nmishin

@Nmishin , have you made progress on this improvement ?

dvaumoron avatar Nov 23 '24 16:11 dvaumoron

@dvaumoron yes, I have something, will send it to review tomorrow

Nmishin avatar Nov 23 '24 21:11 Nmishin

Partially done with #288

dvaumoron avatar Nov 24 '24 17:11 dvaumoron

done in https://github.com/tofuutils/tenv/pull/289

Nmishin avatar Nov 29 '24 10:11 Nmishin