-
Notifications
You must be signed in to change notification settings - Fork 4
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
[bugfix] Straighten out command-line error handling #106
[bugfix] Straighten out command-line error handling #106
Conversation
Thanks for looking into this. As for your question about the custom formatter: it absolutely makes sense, but only where we log an error that is propagated from the entrypoint (e.g. where we previously did Writing that
The This would allow us to create a logger for only the CLI stuff, while the rest of the logging functionality is untouched. |
@fako1024 : see latest PR on logging. Sets the ground work for writing and using the |
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.
Changes requested because we need the:
- plain/CLI logging handler (I prefer plain because it's closer to what the logger does or doesn't do)
- use the logger only in
Execute
if err
stuff because it'll create merge conflicts with global-query #43 that are tedious to fix
6663649
to
7fb1420
Compare
7fb1420
to
d10a872
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.
Good to go from my end. Feel free to merge when available.
Awesome, thanks a lot for taking care of the CLI stuff! I just gave it a quick spin, seems to cover all cases now and error "results" look very readable now. 💪 |
What I've done:
cobra
entrypoint function to simply return the error to the callerExecute()
, using "our" logger with itsFatalf()
methodinit()
instead of viacobra
(to ensure it's already initialized if the error occurs beforecobra
can call the initializer)@els0r For now I've kept this a draft because there are two open questions IMHO:
TBH I don't think that someone running a CLI expects a "logger" style response but rather something like:
The same changes should probably be applied toglobal-query
(because the same problem about not notifying errors happens there as indicated in global-query #43 )What's your take on those open questions?
Closes #104