What's happening?
On Android, errors / exceptions don't have a proper message, and always resort to Unknown T error (e.g. Unknown std::runtime_error error) instead of using it's message (what()).
The same goes for Promise<T>.
I can't really figure out why this is happening - my best guess is that there is some ABI issue with the libc++ standard used by Android NDK, and since errors in Nitro are implemented using std::exception_ptr, the methods current_exception()/rethrow_exception(..) are broken in Android.
I created an issue in the react-native repo: react/react-native#48027
Reproduceable Code
class MyHybrid: public MyHybridSpec {
// ...
public:
void someFunc() override {
throw std::runtime_error("my message!");
}
};
Relevant log output
iOS ✅:
MyHybrid.someFunc(): my message!
Android ❌:
MyHybrid.someFunc() threw an unknown std::runtime_error error.
Device
Huawei P10
Nitro Modules Version
0.18.1
Nitrogen Version
0.18.1
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
What's happening?
On Android, errors / exceptions don't have a proper message, and always resort to
Unknown T error(e.g.Unknown std::runtime_error error) instead of using it's message (what()).The same goes for
Promise<T>.I can't really figure out why this is happening - my best guess is that there is some ABI issue with the libc++ standard used by Android NDK, and since errors in Nitro are implemented using
std::exception_ptr, the methodscurrent_exception()/rethrow_exception(..)are broken in Android.I created an issue in the react-native repo: react/react-native#48027
Reproduceable Code
Relevant log output
iOS ✅:
Android ❌:
MyHybrid.someFunc() threw an unknown std::runtime_error error.Device
Huawei P10
Nitro Modules Version
0.18.1
Nitrogen Version
0.18.1
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