Skip to content

Print HTTP errors on stderr in api command#1115

Merged
vilmibm merged 2 commits intopretty-jsonfrom
api-errors
Jun 10, 2020
Merged

Print HTTP errors on stderr in api command#1115
vilmibm merged 2 commits intopretty-jsonfrom
api-errors

Conversation

@mislav
Copy link
Copy Markdown
Contributor

@mislav mislav commented Jun 5, 2020

Most API errors are present in the response body itself, which will be sent to stdout normally, but if stdout is redirected somewhere (as it's common with scripts), failed HTTP requests will likely sabotage the rest of the script, but no useful info will be shown on stderr, making the case difficult to debug for users.

This makes it so all REST and GraphQL errors are always shown on stderr. Additionally, this makes sure that the command exits with a nonzero status on any GraphQL errors.

Ref. #332

Most API errors are present in the response body itself, which will be
sent to stdout normally, but if stdout is redirected somewhere (as it's
common with scripts), failed HTTP requests will likely sabotage the rest
of the script, but no useful info will be shown on stderr.

This makes it so all REST and GraphQL errors are always shown on stderr.
Additionally, this makes sure that the command exits with a nonzero
status on any GraphQL errors.
@mislav mislav requested review from probablycorey and vilmibm June 5, 2020 16:27
@vilmibm vilmibm merged commit 096bf6b into pretty-json Jun 10, 2020
@mislav mislav deleted the api-errors branch June 11, 2020 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants