1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Always send an error to client if there is. (#1800)

In the production, we need to send a dummy error.
This commit is contained in:
Arunoda Susiripala 2017-04-25 09:45:58 +05:30 committed by GitHub
parent da775f2e11
commit 84d00ad14d

View file

@ -97,7 +97,7 @@ async function doRender (req, res, pathname, query, {
buildId,
buildStats,
assetPrefix,
err: (err && dev) ? errorToJSON(err) : null
err: (err) ? serializeError(dev, err) : null
},
dev,
staticMarkup,
@ -191,6 +191,14 @@ function errorToJSON (err) {
return json
}
function serializeError (dev, err) {
if (dev) {
return errorToJSON(err)
}
return { message: '500 - Internal Server Error.' }
}
export function serveStatic (req, res, path) {
return new Promise((resolve, reject) => {
send(req, path)