SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Integrate logbox into earlyjs c++ pipeline (#46935)

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
R
Ramanpreet Nara committed
9619ba5ce64b93a00903c7e11e5b5e13efebc8fe
Parent: 509abff
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 10/10/2024, 11:03:02 PM