Skip to content

Commit

Permalink
throws error on client
Browse files Browse the repository at this point in the history
  • Loading branch information
dzirtusss committed Aug 17, 2016
1 parent ea95759 commit 048c8d8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions node_package/src/handleError.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ export default (options) => {
console.error(`message: ${e.message}`);
console.error(`stack: ${e.stack}`);

if (serverSide) {
msg += `Exception in rendering!
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;
}
};

0 comments on commit 048c8d8

Please sign in to comment.