Commit 51f5f8f504793351faa020ae6f5b8826c175aceb
handle renderToString errors
Michael Williams committed on 12/31/2015, 5:29:33 AMParent: dbd9f9c0dbba6cc0b96fbf4b1c329a25b5fec854
Files changed
app/stack/render.js | changed |
app/stack/render.js | ||
---|---|---|
@@ -36,9 +36,15 @@ | ||
36 | 36 | const component = <Provider store={store} key="provider"> |
37 | 37 | <RoutingContext { ...renderProps } /> |
38 | 38 | </Provider> |
39 | 39 | |
40 | - const innerHtml = renderToString(component) | |
40 | + var innerHtml | |
41 | + try { | |
42 | + innerHtml = renderToString(component) | |
43 | + } catch (err) { | |
44 | + res.setHeader('content-type', 'text/plain') | |
45 | + res.status(500).send(err.stack) | |
46 | + } | |
41 | 47 | |
42 | 48 | const html = renderFullPage(innerHtml, store.getState()) |
43 | 49 | |
44 | 50 | res.send(html) |
Built with git-ssb-web