Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide default implementation for ReactHostDelegate.handleInstanceEx…
…ception() (facebook#45521) Summary: Pull Request resolved: facebook#45521 [ReactHostDelegate.handleInstanceException()](https://github.com/facebook/react-native/blob/a6f5e5adebed3d9da411f99548e2d8ce96636e16/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt#L48) 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. 1) We may want to consider using `ExceptionsManagerModule` TurboModule in OSS to report the exception but current implementation just [throws JavaScriptException](https://github.com/facebook/react-native/blob/a6f5e5adebed3d9da411f99548e2d8ce96636e16/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java#L67) when it is fatal 2) If 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. 3) In debug build, `DevSupportManager` is called before `handleInstanceException()` 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: [Android][Added] - provide default implementation for ReactHostDelegate.handleInstanceException() Reviewed By: javache Differential Revision: D59847543
- Loading branch information