Skip to content

Conversation

@ryantrem
Copy link
Member

In a nutshell, this change makes unhandled JS errors that bubble back up to native code (through our JSI related code paths) display correctly in the React Native logbox/redbox so you can see what error happened and where. See the big comment in DispatchFunction.h for more details.

  • Add a new BabylonReactNativeShared lib, since we will likely share more code going forward.
  • Add DispatchFunction.h containing the CreateJsRuntimeDispatcher function. This is where the work is done to re-expose the unhandled error in a way that it is displayed in the React Native logbox.
  • Add a library dependency on BabylonReactNativeShared for both the iOS and Android Babylon React Native CMakeLists.txt files.
  • Use CreateJsRuntimeDispatcher in both the iOS and Android Babylon React Native interop layers.

With these changes, when an unhandled exception occurs in JavaScript that is called from our native code, it now shows correctly in logbox:
image

NOTE: This still doesn't work quite right when an unhandled exception comes from JavaScript code that executes as part of Scene.beforeRender. It seems like something in bgfx goes wrong, so I will log a bug for this separately.

@ryantrem ryantrem requested a review from bghgary October 19, 2020 23:17
@ryantrem ryantrem merged commit e5410ed into BabylonJS:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants