-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Top level exception handler #8735
Conversation
Can we merge this for |
There is a need to a dprintf replacement for Windows. We were thinking of adding a method in the Crystal namespace that will mimic a dprintf in Windows. That's the thing that is missing to avoid breaking the build. |
76b5153
to
3c12033
Compare
@@ -96,6 +98,26 @@ module Crystal | |||
def self.main_user_code(argc : Int32, argv : UInt8**) | |||
LibCrystalMain.__crystal_main(argc, argv) | |||
end | |||
|
|||
protected def self.handle_exceptions | |||
begin |
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.
begin ... end
pair is redundant here.
There are many issues where the reported error contains a
Failed to raise an exception: END_OF_STACK
. Many times this is because an error happens outside thebegin/rescue
around__crystal_main
and it ends hiding the real source of the issue. (#8387, #6249, #7810, among others)I added this exception handler a the top level of
Crystal.main
to dump the unhandled exception. I tried to be as conservative as possible, executing the least amount of Crystal's std code.