Commit 84d00ad1 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

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

In the production, we need to send a dummy error.
parent da775f2e
...@@ -97,7 +97,7 @@ async function doRender (req, res, pathname, query, { ...@@ -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) { ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment