provide default implementation for ReactHostDelegate.handleInstanceException() #45521
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.
Summary:
ReactHostDelegate.handleInstanceException() is a no-op so providing a default implementation for this.
As a simplified solution, just throw a
RuntimeException
(on non-debug bulid) in this case. Below is the justification.We may want to consider using
ExceptionsManagerModule
TurboModule in OSS to report the exception but current implementation just throws JavaScriptException when it is fatalIf the exception happens during ReactInstance initialization then we may not have Turbo Module initialized and may not be able to access it. While we might want to fix how this works in longer term but for now just throw an Exception and let the app handle it.
In debug build,
DevSupportManager
is called beforehandleInstanceException()
which would display a RedBox so don't throw when it is a debug build.So it seems to best for now to just throw an exception so it can be handled by the app than silently ignoring it.
Changelog:
[General][Android] - provide default implementation for ReactHostDelegate.handleInstanceException()
Differential Revision: D59847543