Skip to content

Commit

Permalink
Merge pull request #176 from scottnonnenberg/better-debugging
Browse files Browse the repository at this point in the history
Show renderToStaticMarkup errors in develop mode
  • Loading branch information
KyleAMathews committed Mar 7, 2016
2 parents b749902 + b890177 commit 6369abe
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/utils/develop.js
Expand Up @@ -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 = `<!DOCTYPE html>\n${html}`
return reply(html)
try {
const htmlElement = React.createElement(
HTML, {
pages,
config: siteConfig,
}
)
let html = ReactDOMServer.renderToStaticMarkup(htmlElement)
html = `<!DOCTYPE html>\n${html}`
return reply(html)
} catch (e) {
console.log(e.stack)
throw e
}
},
})

Expand Down

0 comments on commit 6369abe

Please sign in to comment.