react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

chore(Worklets): detect runtime initialization failures with experimental bundling

Open tjzel opened this issue 6 months ago • 0 comments

Summary

Throw a QoL error when something went wrong and we received a different error than expected during Worklet Runtime initialization when using experimental bundling.

I had to move reportFatalErrorOnJS to C++ to be able to invoke it on a wrong error. The changes are backwards compatible with legacy bundling.

Test plan

Enable experimental bundling as per instructions in packages/react-native-worklets/experimentalBundling.md and see that there are no crashes.

If a Worklet Runtime failed to initialize, you'll get the following error in JS now (I modified workletRuntimeEntry.ts to achieve those configurations of errors):

Initialization failure of UI Runtime (sync invocation) Initialization failure of Worklet Runtime (sync invocation) Initialization failure of Worklet Runtime (spawned from the UI Thread, async invocation)
Screenshot 2025-06-16 at 19 48 33 Screenshot 2025-06-16 at 19 50 05 Screenshot 2025-06-16 at 20 00 53

For legacy bundling, throw an error in EmptyExample and see that it works just as before.

tjzel avatar Jun 09 '25 09:06 tjzel