Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bejado
Copy link
Member

@bejado bejado commented Mar 28, 2024

On Apple platforms, we should be throwing an NSException, which gives us better crash reporting.

@@ -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);
Copy link
Member Author

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?

Copy link
Collaborator

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.

Copy link

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.

Copy link
Collaborator

@pixelflinger pixelflinger left a 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);
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants