Skip to content

Commit

Permalink
Always send an error to client if there is. (#1800)
Browse files Browse the repository at this point in the history
In the production, we need to send a dummy error.
  • Loading branch information
arunoda committed Apr 25, 2017
1 parent da775f2 commit 84d00ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 84d00ad

Please sign in to comment.