diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index 9d6767d51f380d..d9a8157fd2513d 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -12,13 +12,6 @@ import type {ExtendedError} from './Devtools/parseErrorStack'; -const INTERNAL_CALLSITES_REGEX = new RegExp( - [ - '/Libraries/Renderer/oss/ReactNativeRenderer-dev\\.js$', - '/Libraries/BatchedBridge/MessageQueue\\.js$', - ].join('|'), -); - /** * Handles the developer-visible aspect of errors and exceptions */ @@ -50,14 +43,12 @@ function reportException(e: ExtendedError, isFatal: boolean) { symbolicateStackTrace(stack) .then(prettyStack => { if (prettyStack) { - const stackWithoutInternalCallsites = prettyStack.filter( - frame => - frame.file && - frame.file.match(INTERNAL_CALLSITES_REGEX) === null, + const stackWithoutCollapsedFrames = prettyStack.filter( + frame => !frame.collapse, ); NativeExceptionsManager.updateExceptionMessage( message, - stackWithoutInternalCallsites, + stackWithoutCollapsedFrames, currentExceptionID, ); } else { diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js index f79f2643914b1c..525d020d06960f 100644 --- a/Libraries/Core/NativeExceptionsManager.js +++ b/Libraries/Core/NativeExceptionsManager.js @@ -18,6 +18,7 @@ export type StackFrame = {| file: string, lineNumber: number, methodName: string, + collapse?: boolean, |}; export type ExceptionData = { diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h index 4630310673aeb7..21d5174c475538 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -912,6 +912,7 @@ namespace JS { NSString *file() const; double lineNumber() const; NSString *methodName() const; + folly::Optional collapse() const; StackFrame(NSDictionary *const v) : _v(v) {} private: @@ -2649,6 +2650,11 @@ inline NSString *JS::NativeExceptionsManager::StackFrame::methodName() const id const p = _v[@"methodName"]; return RCTBridgingToString(p); } +inline folly::Optional JS::NativeExceptionsManager::StackFrame::collapse() const +{ + id const p = _v[@"collapse"]; + return RCTBridgingToOptionalBool(p); +} inline NSString *JS::NativeExceptionsManager::ExceptionData::message() const {