Enable logbox for unhandled exceptions that go from JS back to native #98
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.
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.hfor more details.CreateJsRuntimeDispatcherfunction. 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.CreateJsRuntimeDispatcherin 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:

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.