-
Notifications
You must be signed in to change notification settings - Fork 887
chore: add validation errors to the cli output #12814
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
I think the validation errors could be in yellow though, to make them stand out more?
Also can you please add a couple unit tests?
Unfortunately the cli golden file code (which is the only unit test that makes sense for formatting output) does not handle errors. This is because all cli tests invoke the command from within Go, skipping the error handler. You can see this is how we run it in a test: Line 253 in cb1b2ba
Refactoring this will likely break a lot of cli tests since the go I do not want to add a new golden file test for this formatter in this PR. We can come back to testing if we really have formatting drift issues. Edit: Just found an old issue I made: #11588. Exactly this. |
@Emyrk given this is now in place, should we add a couple tests to it to encompass the new functionality?
Looks great! Thanks |
Tests were added here. These cover all example errors, which covers the validation errors here. I'll rebase on main to get them. |
cb1b2ba
to
13bd167
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Closes #12575
Error:
Before:
After:
If you did not know,
coder exp example-error <subcommand>
has a set of sub commands to see how different cli errors are rendered out. No need to make them occur naturally.