Don't ignore synchronous errors when calling Node

This commit is contained in:
SteveSandersonMS
2015-12-14 13:16:39 +00:00
parent 918d8d422a
commit 80575a092e
4 changed files with 31 additions and 19 deletions

View File

@@ -45,10 +45,14 @@ function loadViaBabel(module, filename) {
module.exports = {
renderToString: function(callback, options) {
var component = findReactComponent(options);
var history = createMemoryHistory(options.requestUrl);
var reactElement = React.createElement(component, { history: history });
var html = ReactDOMServer.renderToString(reactElement);
callback(null, html);
try {
var component = findReactComponent(options);
var history = createMemoryHistory(options.requestUrl);
var reactElement = React.createElement(component, { history: history });
var html = ReactDOMServer.renderToString(reactElement);
callback(null, html);
} catch (synchronousException) {
callback(synchronousException);
}
}
};