aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-11-01 21:17:08 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:58 +0300
commit4761552440b0a2cfd3dea887201f61b5ed757bb7 (patch)
treef455c7382101a3db1869e49a99afe655594dd72f /vnext
parent734c00bbd4a1690fd8e5149644671fd7c4adba25 (diff)
SSR: handle shell errors
Diffstat (limited to 'vnext')
-rw-r--r--vnext/server/middleware/renderer.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/vnext/server/middleware/renderer.js b/vnext/server/middleware/renderer.js
index ca2ac2df..646e7d6c 100644
--- a/vnext/server/middleware/renderer.js
+++ b/vnext/server/middleware/renderer.js
@@ -63,8 +63,19 @@ const serverRenderer = async (req, res) => {
res.write(propsData);
pipe(res, { end: false });
},
+ onShellError() {
+ didError = true;
+ res.statusCode = 500;
+ res.setHeader('Content-type', 'text/html');
+ res.send(
+ '<h1>Something went wrong :(</h1>'
+ );
+ res.end();
+ },
onAllReady() {
- res.write(data[1]);
+ if (!didError) {
+ res.write(data[1]);
+ }
res.end();
},
onError(err) {