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
Throw an NSException on Apple platforms when panicking #7720
base: main
Are you sure you want to change the base?
Conversation
@@ -139,6 +152,11 @@ void TPanic<T>::panic(char const* function, char const* file, int line, const ch | |||
va_end(args); | |||
T e(function, formatFile(file), line, reason); | |||
e.log(); | |||
|
|||
#if defined(__APPLE__) | |||
details::throwDarwinException(e); |
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.
Actually, we may want to give users the option of which type of exception they want thrown, maybe through a compile-time flag. @pixelflinger thoughts?
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.
I'm thinking we should throw the C++ exception first if enabled. If not it'll revert to the darwinException.
If the user wants a darwin exception that can always throw one from their C++ exception handler.
Please add a release note line to NEW_RELEASE_NOTES.md. If this PR does not warrant a release note, add the 'internal' label to this PR. |
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.
give priority to the C++ exception
@@ -139,6 +152,11 @@ void TPanic<T>::panic(char const* function, char const* file, int line, const ch | |||
va_end(args); | |||
T e(function, formatFile(file), line, reason); | |||
e.log(); | |||
|
|||
#if defined(__APPLE__) | |||
details::throwDarwinException(e); |
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.
I'm thinking we should throw the C++ exception first if enabled. If not it'll revert to the darwinException.
If the user wants a darwin exception that can always throw one from their C++ exception handler.
On Apple platforms, we should be throwing an
NSException
, which gives us better crash reporting.