-
-
Notifications
You must be signed in to change notification settings - Fork 67
Description
What's happening?
Firstly, this project is awesome!
When @shopify/react-native-skia is added as a dependency and pods are installed, error messages from Swift/C++ native code are no longer propagated correctly to JavaScript. Instead of showing the actual error message, all errors show as "Error: Unknown std::runtime_error error."
I noticed this in my private Expo App (using Expo 53/React Native 0.79.5 initially and persisted in Expo 54/React Native 0.81.4) when none of my error contexts from my own Nitro Module usingRuntimeError.error(withMessage: [custom error message] were propagating to my JS code.
I have easily been able to reproduce this error by adding react-native-skia to the example app of this repo.
This issue was previously mentioned in #382, but that issue was closed. The problem still persists on the latest main branch. Without react-native-skia installed, all tests pass correctly and error messages propagate as expected.
It seems like there might be a conflict in how error handling works when multiple native modules using C++/JSI are present. The error messages are being stripped somewhere in the exception propagation chain when Skia is loaded.
Reproduceable Code
Relevant log output
❌ Test "funcThatThrows() throws" failed!
Expected: "TestObjectCpp.funcThatThrows(...):"
Got: "Error: `TestObjectCpp.funcThatThrows(...)` threw an unknown std::runtime_error error."
❌ Test "funcThatThrowsBeforePromise() throws" failed!
Expected: "TestObjectCpp.funcThatThrowsBeforePromise(...):"
Got: "Error: `TestObjectCpp.funcThatThrowsBeforePromise(...)` threw an unknown std::runtime_error
error."
❌ Test "set someVariant to false" failed!
Expected: "Error: TestObjectCpp.someVariant: Cannot convert "false" to any type in
variant<std::string, double>!"
Got: "Error: `TestObjectCpp.someVariant` threw an unknown std::runtime_error error."
❌ Test "promiseThrows() throws" failed!
Expected: "Error: Promise throws :)"
Got: "Error: Unknown std::runtime_error error."
[... 9 total test failures with same pattern]Device
iPhone 16 - iOS 18.3.1
Nitro Modules Version
0.29.8
Nitrogen Version
0.29.8
Can you reproduce this issue in the Nitro Example app here?
Yes, I can reproduce the same issue in the Example app here
Additional information
- I am using Expo
- I am using nitrogen
- I have read and followed the Troubleshooting Guide.
- I created a reproduction PR to reproduce this issue here in the nitro repo. (See Contributing for more information)
- I searched for similar issues in this repository and found none.