Flight client error stack (#25560)
restore error message into stack for flight prod errors
Josh Story committed
Oct 24, 2022 at 16:32 UTC
d925a8d0be69595bab9f7c8698df39ab68b68750
2 files changed
+4
-1
packages/react-client/src/ReactFlightClient.js
+1
-1
@@ -646,7 +646,7 @@ export function resolveErrorProd(
646
' builds to avoid leaking sensitive details. A digest property is included on this error instance which' +
647
' may provide additional details about the nature of the error.',
648
);
649
- error.stack = '';
649
+ error.stack = 'Error: ' + error.message;
650
(error: any).digest = digest;
651
const errorWithDigest: ErrorWithDigest = (error: any);
652
const chunks = response._chunks;
packages/react-client/src/__tests__/ReactFlight-test.js
+3
@@ -57,6 +57,9 @@ describe('ReactFlight', () => {
57
' may provide additional details about the nature of the error.',
58
);
59
expect(this.state.error.digest).toContain(this.props.expectedMessage);
60
+ expect(this.state.error.stack).toBe(
61
+ 'Error: ' + this.state.error.message,
62
+ );
63
}
64
}
65
render() {