Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When outputting JSON (i.e. --json), CLI should report errors in JSON format #382

Open
jakedoublev opened this issue Sep 12, 2024 · 0 comments

Comments

@jakedoublev
Copy link
Contributor

I found myself confused this morning running commands with --json because we're squashing prints to stdout (intentionally).

We should unify printing to stderr {"error":} if we have an error and the CLI should be outputting JSON, rather than nothing and just the exit code.

image (3)

Acceptance Criteria

  1. cli.ExitWithError should detect if the output format is JSON and structure the error output in JSON
  2. cli.ExitWithWarning should detect if the output format is JSON and structure the warning output as an error in JSON
  3. BATS tests go through 3-4 error/warning paths and expect JSON error output
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

No branches or pull requests

1 participant