Skip to content

Commit 494156b

Browse files
author
Sebastian Markbage
committed
Implement shell error handling in Node SSR fixtures
Instead of hanging indefinitely.
1 parent 30894a7 commit 494156b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

fixtures/ssr/server/render.js

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export default function render(url, res) {
2828
res.setHeader('Content-type', 'text/html');
2929
pipe(res);
3030
},
31+
onErrorShell(x) {
32+
// Something errored before we could complete the shell so we emit an alternative shell.
33+
res.statusCode = 500;
34+
res.send('<!doctype><p>Error</p>');
35+
},
3136
onError(x) {
3237
didError = true;
3338
console.error(x);

fixtures/ssr2/server/render.js

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ module.exports = function render(url, res) {
4949
res.setHeader('Content-type', 'text/html');
5050
pipe(res);
5151
},
52+
onErrorShell(x) {
53+
// Something errored before we could complete the shell so we emit an alternative shell.
54+
res.statusCode = 500;
55+
res.send('<!doctype><p>Error</p>');
56+
},
5257
onError(x) {
5358
didError = true;
5459
console.error(x);

0 commit comments

Comments
 (0)