Commit aa3e1abb authored by Seongjun Kim's avatar Seongjun Kim

server-side-rendering error handling

express should not be crushed even if server-side-rendering occurs an error.
parent 7a932e9f
......@@ -59,10 +59,9 @@ app.get('*', (req, res) => {
const renderStream = renderer.renderToStream(context)
let firstChunk = true
res.write(html.head)
renderStream.on('data', chunk => {
if (firstChunk) {
res.write(html.head)
// embed initial store state
if (context.initialState) {
res.write(
......@@ -82,7 +81,9 @@ app.get('*', (req, res) => {
})
renderStream.on('error', err => {
throw err
// Render Error Page or Redirect
res.status(500).end('Internal Error 500')
console.error(`error during render : ${req.url}`)
})
})
......
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