- Notifications
You must be signed in to change notification settings - Fork928
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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?
Emyrk commentedMar 29, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 theerror handler. You can see this is how we run it in a test: Line 253 incb1b2ba
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
to13bd167
CompareThere 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!
Uh oh!
There was an error while loading.Please reload this page.
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.