Add js engine information in React Native error reporting

Summary:
To avoid "js engine: ..." appearing everywhere, only add this information
to the error message when react native is reporting errors to the server.

Reviewed By: yungsters

Differential Revision: D9754371

fbshipit-source-id: a8001480c75ccf93c953c79f26470df678871cb3
This commit is contained in:
Yue Xu 2018-09-12 13:55:58 -07:00 committed by Facebook Github Bot
parent 6e980a826e
commit 2b1d8cc54b
2 changed files with 5 additions and 6 deletions

View File

@ -19,6 +19,7 @@ export type StackFrame = {
export type ExtendedError = Error & { export type ExtendedError = Error & {
framesToPop?: number, framesToPop?: number,
jsEngine?: string,
}; };
function parseErrorStack(e: ExtendedError): Array<StackFrame> { function parseErrorStack(e: ExtendedError): Array<StackFrame> {

View File

@ -22,18 +22,16 @@ function reportException(e: ExtendedError, isFatal: boolean) {
const parseErrorStack = require('parseErrorStack'); const parseErrorStack = require('parseErrorStack');
const stack = parseErrorStack(e); const stack = parseErrorStack(e);
const currentExceptionID = ++exceptionID; const currentExceptionID = ++exceptionID;
const message =
e.jsEngine == null ? e.message : `${e.message}, js engine: ${e.jsEngine}`;
if (isFatal) { if (isFatal) {
ExceptionsManager.reportFatalException( ExceptionsManager.reportFatalException(
e.message, message,
stack, stack,
currentExceptionID, currentExceptionID,
); );
} else { } else {
ExceptionsManager.reportSoftException( ExceptionsManager.reportSoftException(message, stack, currentExceptionID);
e.message,
stack,
currentExceptionID,
);
} }
if (__DEV__) { if (__DEV__) {
const symbolicateStackTrace = require('symbolicateStackTrace'); const symbolicateStackTrace = require('symbolicateStackTrace');