From 2b1d8cc54bf46c31ad2ab5f1eca640fa83d96f39 Mon Sep 17 00:00:00 2001 From: Yue Xu Date: Wed, 12 Sep 2018 13:55:58 -0700 Subject: [PATCH] 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 --- Libraries/Core/Devtools/parseErrorStack.js | 1 + Libraries/Core/ExceptionsManager.js | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index e34ccb11f..ff308d1dd 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -19,6 +19,7 @@ export type StackFrame = { export type ExtendedError = Error & { framesToPop?: number, + jsEngine?: string, }; function parseErrorStack(e: ExtendedError): Array { diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index 8f6df7e1f..08fe06f72 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -22,18 +22,16 @@ function reportException(e: ExtendedError, isFatal: boolean) { const parseErrorStack = require('parseErrorStack'); const stack = parseErrorStack(e); const currentExceptionID = ++exceptionID; + const message = + e.jsEngine == null ? e.message : `${e.message}, js engine: ${e.jsEngine}`; if (isFatal) { ExceptionsManager.reportFatalException( - e.message, + message, stack, currentExceptionID, ); } else { - ExceptionsManager.reportSoftException( - e.message, - stack, - currentExceptionID, - ); + ExceptionsManager.reportSoftException(message, stack, currentExceptionID); } if (__DEV__) { const symbolicateStackTrace = require('symbolicateStackTrace');