Skip to content

Commit 3fc531a

Browse files
committed
prerender: Log failed HTTP requests
1 parent dcdd8fd commit 3fc531a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

prerender-server/src/server.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ app.use((req, res, next) => {
4040
render(req._parsedUrl.pathname, req._parsedUrl.query || '', req.body, { theme, lang }, (err, resp) => {
4141
if (err) return next(err)
4242
if (resp.redirect) return res.redirect(301, baseHref + resp.redirect.substr(1))
43-
if (resp.errorCode) return res.sendStatus(resp.errorCode)
43+
if (resp.errorCode) {
44+
console.error(`Failed with code ${resp.errorCode}:`, resp)
45+
return res.sendStatus(resp.errorCode)
46+
}
4447

4548
res.status(resp.status || 200)
4649
res.render(indexView, {

0 commit comments

Comments
 (0)