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:
parent
da775f2e11
commit
84d00ad14d
|
@ -97,7 +97,7 @@ async function doRender (req, res, pathname, query, {
|
||||||
buildId,
|
buildId,
|
||||||
buildStats,
|
buildStats,
|
||||||
assetPrefix,
|
assetPrefix,
|
||||||
err: (err && dev) ? errorToJSON(err) : null
|
err: (err) ? serializeError(dev, err) : null
|
||||||
},
|
},
|
||||||
dev,
|
dev,
|
||||||
staticMarkup,
|
staticMarkup,
|
||||||
|
@ -191,6 +191,14 @@ function errorToJSON (err) {
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializeError (dev, err) {
|
||||||
|
if (dev) {
|
||||||
|
return errorToJSON(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return { message: '500 - Internal Server Error.' }
|
||||||
|
}
|
||||||
|
|
||||||
export function serveStatic (req, res, path) {
|
export function serveStatic (req, res, path) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
send(req, path)
|
send(req, path)
|
||||||
|
|
Loading…
Reference in a new issue