react-native-macos/Libraries/FBReactNativeSpec
Moti Zilberman 3a825c0360 Introduce NativeExceptionsManager.reportException API
Summary:
@public

`reportException` is a new method on `NativeExceptionsManager` that is designed to allow more structured and flexible JS error reporting. `reportFatalException` and `reportSoftException` are now deprecated.

In addition to all the usual exception fields, `reportException` also accepts an `extraData` property which the JS exception handler can populate with arbitrary JSON-serialisable data (here: the raw stack trace, the current JS engine, and the number of frames popped off the call stack by the exception handler). The contents of `extraData` get attached as JSON to the `JavascriptException` instance (or just logged, in the case of `console.error`).

This change is backwards compatible in two senses:
1. We have a JS fallback that uses `reportFatalException` and `reportSoftException` if the new native method is unavailable.
2. We have a Java fallback that implements `reportFatalException` and `reportSoftException` in terms of `reportException`.

Naturally, both fallbacks mentioned above discard `extraData`.

NOTE: The current implementation is Android-only; for the time being, iOS will continue to use the JS fallback.

While we're in `ExceptionsManager.js`, this also changes `dismissRedbox()` to be optional (which it is, since it's Android-only); existing call sites already guard it with a null check so this requires no other changes.

Reviewed By: mmmulani

Differential Revision: D16133080

fbshipit-source-id: d0b209d58da40b736df63155bbea232e94ce635c
2019-07-16 09:38:03 -07:00
..
FBReactNativeSpec Introduce NativeExceptionsManager.reportException API 2019-07-16 09:38:03 -07:00
BUCK use the github checked-in version of the Spec codegen output 2019-06-26 11:19:34 -07:00
FBReactNativeSpec.podspec iOS: Added missing React-jsi dep for FBReactNativeSpec target 2019-07-12 22:44:21 -07:00