Skip to content

Commit 2d93439

Browse files
committed
Emit Server Error Prefix in the .stack Property Too (#28738)
Follow up to #28684. V8 includes the message in the stack and printed errors include just the stack property which is assumed to contain the message. Without this, the prefix doesn't get printed in the console. <img width="578" alt="Screenshot 2024-04-03 at 6 32 04 PM" src="https://github.com/facebook/react/assets/63648/d98a2db4-6ebc-4805-b669-59f449dfd21f"> A possible alternative would be to use a nested error with a `cause` like #28736 but that would need some more involved serializing since this prefix is coming from the server. Perhaps as a separate attribute. DiffTrain build for [583eb67](583eb67)
1 parent ce3ba22 commit 2d93439

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20e710aeab3e03809c82d134171986ea270026a0
1+
583eb6770d56e9793d3660bd9c6782fdebc93729

compiled/facebook-www/ReactDOMServer-dev.classic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "19.0.0-www-classic-81cf15cb";
22+
var ReactVersion = "19.0.0-www-classic-6ac6cbda";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -11516,7 +11516,7 @@ if (__DEV__) {
1151611516
? "Switched to client rendering because the server rendering aborted due to:\n\n"
1151711517
: "Switched to client rendering because the server rendering errored:\n\n";
1151811518
boundary.errorMessage = prefix + message;
11519-
boundary.errorStack = stack;
11519+
boundary.errorStack = stack !== null ? prefix + stack : null;
1152011520
boundary.errorComponentStack = thrownInfo.componentStack;
1152111521
}
1152211522
}

compiled/facebook-www/ReactDOMServer-dev.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (__DEV__) {
1919
var React = require("react");
2020
var ReactDOM = require("react-dom");
2121

22-
var ReactVersion = "19.0.0-www-modern-e2470d87";
22+
var ReactVersion = "19.0.0-www-modern-53247bf3";
2323

2424
// This refers to a WWW module.
2525
var warningWWW = require("warning");
@@ -11437,7 +11437,7 @@ if (__DEV__) {
1143711437
? "Switched to client rendering because the server rendering aborted due to:\n\n"
1143811438
: "Switched to client rendering because the server rendering errored:\n\n";
1143911439
boundary.errorMessage = prefix + message;
11440-
boundary.errorStack = stack;
11440+
boundary.errorStack = stack !== null ? prefix + stack : null;
1144111441
boundary.errorComponentStack = thrownInfo.componentStack;
1144211442
}
1144311443
}

compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11316,7 +11316,7 @@ if (__DEV__) {
1131611316
? "Switched to client rendering because the server rendering aborted due to:\n\n"
1131711317
: "Switched to client rendering because the server rendering errored:\n\n";
1131811318
boundary.errorMessage = prefix + message;
11319-
boundary.errorStack = stack;
11319+
boundary.errorStack = stack !== null ? prefix + stack : null;
1132011320
boundary.errorComponentStack = thrownInfo.componentStack;
1132111321
}
1132211322
}

0 commit comments

Comments
 (0)