-
Notifications
You must be signed in to change notification settings - Fork 51
fix: fix exception handling in C++ native code #244
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
Merged
JakubGonera
merged 10 commits into
@jakubgonera/cpp
from
@jakubgonera/style-transfer-exceptions
May 20, 2025
Merged
fix: fix exception handling in C++ native code #244
JakubGonera
merged 10 commits into
@jakubgonera/cpp
from
@jakubgonera/style-transfer-exceptions
May 20, 2025
Conversation
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
This was
linked to
issues
May 6, 2025
63172e6 to
0fd19e3
Compare
NorbertKlockiewicz
approved these changes
May 12, 2025
mkopcins
approved these changes
May 14, 2025
c8cbe4a to
a991245
Compare
20ba72c to
452ede5
Compare
Base automatically changed from
@jakubgonera/style-transfer-cpp
to
@jakubgonera/cpp
May 20, 2025 13:13
d72b399 to
1ae1b35
Compare
JakubGonera
added a commit
that referenced
this pull request
May 28, 2025
## Description Fix exception handling in C++ native code so that it results in JS promise getting rejected with an appropriate message. There are two fixes here: 1. Runtime type information in the current version of React Native is disabled because one of its dependencies, which results in C++ not being able to recognize that `std::runtime_error` is inheriting from `std::exception` so to extract the exception message we need to match the type exactly. A fix has been introduced in RN repo, but not yet present in any release: facebook/react-native@3132cc8. 2. When rejecting a promise the old code was accessing JS runtime in an unsafe way, this is fixed now. ### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [x] iOS - [x] Android
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.
Description
Fix exception handling in C++ native code so that it results in JS promise getting rejected with an appropriate message. There are two fixes here:
std::runtime_erroris inheriting fromstd::exceptionso to extract the exception message we need to match the type exactly. A fix has been introduced in RN repo, but not yet present in any release: facebook/react-native@3132cc8.Type of change
Tested on