From b890177f082b33490ac98e073fe46ec69c47d11a Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 7 Mar 2016 10:40:28 -0800 Subject: [PATCH] Show renderToStaticMarkup errors in develop mode --- lib/utils/develop.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/utils/develop.js b/lib/utils/develop.js index f1fc712cf512c..788d2ce3162eb 100644 --- a/lib/utils/develop.js +++ b/lib/utils/develop.js @@ -76,15 +76,20 @@ module.exports = (program) => { return reply(Boom.notFound()) } - const htmlElement = React.createElement( - HTML, { - pages, - config: siteConfig, - } - ) - let html = ReactDOMServer.renderToStaticMarkup(htmlElement) - html = `\n${html}` - return reply(html) + try { + const htmlElement = React.createElement( + HTML, { + pages, + config: siteConfig, + } + ) + let html = ReactDOMServer.renderToStaticMarkup(htmlElement) + html = `\n${html}` + return reply(html) + } catch (e) { + console.log(e.stack) + throw e + } }, })