Report error cause with native stacktrace for Turbo Module exceptions#2686
Merged
hamudi-ahmed merged 3 commits intonextfrom Mar 3, 2026
Merged
Report error cause with native stacktrace for Turbo Module exceptions#2686hamudi-ahmed merged 3 commits intonextfrom
hamudi-ahmed merged 3 commits intonextfrom
Conversation
d364136 to
e4d896d
Compare
e4d896d to
e32a479
Compare
SB-priyankap
pushed a commit
that referenced
this pull request
Mar 11, 2026
…o module exceptions (#2686) * feat(react-native): native stacktraces for turbo module exceptions * test(react-native): add e2e tests for turbo module mixed stacktraces * docs: add changelog entry
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
In The New Architecture, when an unhandled exception occurs in a Turbo Module method, React Native throws a JS error with a
causeproperty containing the native exception class, error message and stacktrace.Although the JS SDK supports error causes, these native causes are not parsed correctly in events as they don't contain valid JS stacktraces (the cause stack is reported as
stackElementson Android andstackSymbols/stackReturnAddresseson iOS) - so we end up reporting events with an empty stacktrace in the 'Caused by' error.This PR fixes the error reporting for these cases, so that native 'Caused by' errors are reported correctly with a full native stacktrace while maintaining backwards compatibility with native stack handling for Old Architecture.
(Note: on iOS, exceptions in async Turbo Module methods result in a native crash that is detected by the Cocoa SDK, so this does not apply in those cases)
Changeset
Updated the native stack handling in
delivery-react-nativeto extract thenativeStackproperty for native error causes.Updated
BugsnagEventDeserializer.min the iOS native module to correctly handle events containing multiple errors (the equivalent changes for Android were released in v6.22.0 ofbugsnag-plugin-react-native)Testing
Added new unit test and e2e test cases