diff --git a/node_package/src/clientStartup.js b/node_package/src/clientStartup.js index 0075bfb72..0c7ebba54 100644 --- a/node_package/src/clientStartup.js +++ b/node_package/src/clientStartup.js @@ -78,11 +78,8 @@ You should return a React.Component always for the client side entry point.`); } } } catch (e) { - handleError({ - e, - name, - serverSide: false, - }); + e.message = `Exception in rendering ${name}. ${e.message}`; + throw e; } } diff --git a/node_package/src/handleError.js b/node_package/src/handleError.js index a977e60cd..0c5f70b70 100644 --- a/node_package/src/handleError.js +++ b/node_package/src/handleError.js @@ -53,19 +53,14 @@ export default (options) => { console.error(`message: ${e.message}`); console.error(`stack: ${e.stack}`); - msg += `Exception in rendering! + if (serverSide) { + msg += `Exception in rendering! ${e.fileName ? `\nlocation: ${e.fileName}:${e.lineNumber}` : ''} Message: ${e.message} ${e.stack}`; - if (serverSide) { const reactElement = React.createElement('pre', null, msg); return ReactDOMServer.renderToString(reactElement); - } else { - var newError = new Error(msg); - - newError.cause = e; - throw newError; } };