Skip to content

Commit cdeeb04

Browse files
committed
update error message to make more sense in node contexts
1 parent 06354fc commit cdeeb04

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ describe('ReactDOMFizzServer', () => {
11081108
errors,
11091109
[
11101110
[
1111-
'The server did not finish this Suspense boundary: signal is aborted without reason',
1111+
'The server did not finish this Suspense boundary: The render was aborted by the server without a reason.',
11121112
expectedDigest,
11131113
componentStack(['h1', 'Suspense', 'div', 'App']),
11141114
],

packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ describe('ReactDOMFizzServer', () => {
222222
const result = await readResult(stream);
223223
expect(result).toContain('Loading');
224224

225-
expect(errors).toEqual(['signal is aborted without reason']);
225+
expect(errors).toEqual([
226+
'The render was aborted by the server without a reason.',
227+
]);
226228
});
227229

228230
// @gate experimental
@@ -261,7 +263,9 @@ describe('ReactDOMFizzServer', () => {
261263
const reader = stream.getReader();
262264
reader.cancel();
263265

264-
expect(errors).toEqual(['signal is aborted without reason']);
266+
expect(errors).toEqual([
267+
'The render was aborted by the server without a reason.',
268+
]);
265269

266270
hasLoaded = true;
267271
resolve();

packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ describe('ReactDOMFizzServer', () => {
363363

364364
expect(errors).toEqual([
365365
// There are two boundaries that abort
366-
'signal is aborted without reason',
367-
'signal is aborted without reason',
366+
'The render was aborted by the server without a reason.',
367+
'The render was aborted by the server without a reason.',
368368
]);
369369
expect(output.error).toBe(undefined);
370370
expect(output.result).toContain('Loading');

packages/react-server-dom-relay/src/__tests__/ReactDOMServerFB-test.internal.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ describe('ReactDOMServerFB', () => {
191191
const remaining = readResult(stream);
192192
expect(remaining).toEqual('');
193193

194-
expect(errors).toEqual(['signal is aborted without reason']);
194+
expect(errors).toEqual([
195+
'The render was aborted by the server without a reason.',
196+
]);
195197
});
196198
});

packages/react-server/src/ReactFizzServer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,7 @@ function abortTask(task: Task, request: Request, reason: mixed): void {
15541554
boundary.forceClientRender = true;
15551555
let error =
15561556
reason === undefined
1557-
? // eslint-disable-next-line react-internal/prod-error-codes
1558-
new Error('signal is aborted without reason')
1557+
? new Error('The render was aborted by the server without a reason.')
15591558
: reason;
15601559
boundary.errorDigest = request.onError(error);
15611560
if (__DEV__) {

scripts/error-codes/codes.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,7 @@
417417
"429": "ServerContext: %s already defined",
418418
"430": "ServerContext can only have a value prop and children. Found: %s",
419419
"431": "React elements are not allowed in ServerContext",
420-
"432": "This Suspense boundary was aborted by the server.",
420+
"432": "The render was aborted by the server without a reason.",
421421
"433": "useId can only be used while React is rendering",
422-
"434": "`dangerouslySetInnerHTML` does not make sense on <title>.",
423-
"435": "The server did not finish this Suspense boundary. The server used \"%s\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \"%s\" which supports Suspense on the server"
424-
}
422+
"434": "`dangerouslySetInnerHTML` does not make sense on <title>."
423+
}

0 commit comments

Comments
 (0)