Skip to content

Commit 84d00ad

Browse files
authored
Always send an error to client if there is. (vercel#1800)
In the production, we need to send a dummy error.
1 parent da775f2 commit 84d00ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/render.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async function doRender (req, res, pathname, query, {
9797
buildId,
9898
buildStats,
9999
assetPrefix,
100-
err: (err && dev) ? errorToJSON(err) : null
100+
err: (err) ? serializeError(dev, err) : null
101101
},
102102
dev,
103103
staticMarkup,
@@ -191,6 +191,14 @@ function errorToJSON (err) {
191191
return json
192192
}
193193

194+
function serializeError (dev, err) {
195+
if (dev) {
196+
return errorToJSON(err)
197+
}
198+
199+
return { message: '500 - Internal Server Error.' }
200+
}
201+
194202
export function serveStatic (req, res, path) {
195203
return new Promise((resolve, reject) => {
196204
send(req, path)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy