mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385 fbshipit-source-id: 9c01e1cfe0ec80842af2e5bcfbf0adfb040dbcf3