-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: panic based error handling #36189
Comments
Make a go-gettable package with these functions and lets see how many people find them useful. |
I should have already done this: does |
https://github.com/mpvl/errc implements a similar idea. |
I was not aware of this package, good find. I think there is still some bike shedding left to get an optimized interface, but |
Is any additional information required, or is this proposal on |
This doesn't need to be in the standard library, and we've decided not to add more error handling changes for quite some time. Thanks for publishing the idea as a separate package others can already import. This seems like a likely decline. |
While I agree, the same could be said about
I am sad to hear this because of how cumbersome error handling is in Go, but also confused by the distance from how I read the recent blog post. I think it would be helpful to convey your exact words to the community, as many are still motivated to improve the state of error handling in Go. |
The next paragraph in that blog post says "with error handling changes out of the way for the time being". |
There's no change in consensus, so declining. |
Since "there is really nothing wrong with using
panic
within a single package", as discussed in #35093, I thought I would use this to propose improving error handling. My apologies if this duplicates other proposals, and feel free to merge/close as appropriate.I suggest adding two new functions to the
errors
package:errors.Check
errors.Handlef
Because these primitives can be implemented in pure go1, I have built a sample implementation:
This is proposal borrows exact syntax heavily from the
try
proposal, howeverpanic
could be used differently:The text was updated successfully, but these errors were encountered: