phrase / phrase-cli

CLI for the Phrase API
https://developers.phrase.com
MIT License
42 stars 6 forks source link

Provide actionable error message #51

Closed exoego closed 3 years ago

exoego commented 3 years ago

curl give actionable message like this:

$> curl "https://api.phrase.com/v2/projects/PROJECT_ID/locales/LOCALE_ID/download" -u "TOKEN"
{"message":"Invalid Download Options. Parameter file_format Please fill out this field. Parameter file_format is not included in the list","documentation_url":"https://developers.phrase.com/api/#get-/projects/{project_id}/locales/{id}/download"}%   

In the above example, user can understand file_format is not included.

However, cli give only HTTP response code like below:

$> phrase locales download \
  --access_token TOKEN \
  --project_id PROJECT_ID \
  --id LOCALE_ID
Error: 400 Bad Request

even with --verbose flag.

It would be helpful if CLI gives actionable error message.

theSoenke commented 3 years ago

Hi @exoego, that is a really good point. The error messages are not really helpful. We'll have a closer look at this and I'll post the updates here

egze commented 3 years ago

Hi @exoego

This is now the output in 2.0.16.

 $> phrase locales download --access_token TOKEN --project_id PROJECT_ID --id LOCALE_ID

{"message":"Invalid Download Options. Parameter file_format Please fill out this field. Parameter file_format is not included in the list","documentation_url":"https://developers.phrase.com/api/#get-/projects/{project_id}/locales/{id}/download"}

Error: 400 Bad Request
exoego commented 3 years ago

Great, thanks !! Closing as resolved