@samitouri / QOS-React / commits / f923adb585

Pass component stack to error boundary handler (#9073)

This information is probably more useful for custom redbox components than the call stack info we are already passing.

Brian Vaughn committed Feb 27, 2017 at 16:53 UTC f923adb5856a2c251039c8a435d77be9d0542a4f
1 file changed +10 -1
src/renderers/shared/fiber/ReactFiberScheduler.js
+10 -1
@@ -27,6 +27,10 @@ export type CapturedError = {
27 willRetry : boolean,
28 };
29
30 +export type HandleErrorInfo = {
31 + componentStack : string,
32 +};
33 +
34 var {
35 popContextProvider,
36 } = require('ReactFiberContext');
@@ -1077,9 +1081,14 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P,
1081 switch (effectfulFiber.tag) {
1082 case ClassComponent:
1083 const instance = effectfulFiber.stateNode;
1084 +
1085 + const info : HandleErrorInfo = {
1086 + componentStack: capturedError.componentStack,
1087 + };
1088 +
1089 // Allow the boundary to handle the error, usually by scheduling
1090 // an update to itself
1082 - instance.unstable_handleError(error);
1091 + instance.unstable_handleError(error, info);
1092 return;
1093 case HostRoot:
1094 if (firstUncaughtError === null) {