-
Notifications
You must be signed in to change notification settings - Fork 295
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
panic(nil) not handled properly #975
Comments
This seems like this may have been caused by a misinterpretation of some legacy code. A panic is a panic, even if its value is nil. We will address this issue in an upcoming relese. |
Ok, after assessing the internal tests, it does seem like this project historically did avoid collecting nil errors. This may change the behavior of the app in user's environments. I'm going to label this as a feature request for now, and we will figure out how to move forward from there. |
@iamemilio The current behavior is a bug. If I do I also don't know how not collecting nil errors is relevant. As I mentioned, previously it was not possible to tell the difference between "no panic" and Lastly, while it is true that |
Ah ok, thats totally different. Agreed, we are making this a high priority bug. Thanks for clarifying the issue! |
The fix for this issue will be in the next release. |
Prior to Go 1.21,
recover
could returnnil
in two cases:panic(nil)
Therefore, it was not possible to distinguish the two.
Now (barring
GODEBUG=panicnil=1
), explicitly callingpanic(nil)
will causerecover
to returnruntime.PanicNilError
, which means the two case are distinguishable.In this light, I don't understand the intent of the changes in #960. Now this library now goes out of its way to treat the two cases the same again. In particular, it will treat
runtime.PanicNilError
as if it didn't panic.I would expect
panic(nil)
to be treated the same as any other panic, which was the motivation for the change in Go 1.21. Why isruntime.PanicNilError
treated specially by this library?The text was updated successfully, but these errors were encountered: