diff --git a/packages/shared/ReactComponentStackFrame.js b/packages/shared/ReactComponentStackFrame.js index 1a10125f9cb0d..c9946855f8d0e 100644 --- a/packages/shared/ReactComponentStackFrame.js +++ b/packages/shared/ReactComponentStackFrame.js @@ -91,7 +91,7 @@ export function describeNativeComponentFrame( if (construct) { // Something should be setting the props in the constructor. const Fake = function() { - return Error(); + throw Error(); }; // $FlowFixMe Object.defineProperty(Fake.prototype, 'props', { @@ -104,14 +104,26 @@ export function describeNativeComponentFrame( if (typeof Reflect === 'object' && Reflect.construct) { // We construct a different control for this case to include any extra // frames added by the construct call. - control = Reflect.construct(Fake, []); + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } Reflect.construct(fn, [], Fake); } else { - control = Error(); + try { + Fake.call(); + } catch (x) { + control = x; + } fn.call(new Fake()); } } else { - control = Error(); + try { + throw Error(); + } catch (x) { + control = x; + } fn(); } } catch (sample) {