Skip to content

Commit

Permalink
moved throw from handleError to clientStartup
Browse files Browse the repository at this point in the history
  • Loading branch information
dzirtusss committed Aug 18, 2016
1 parent 048c8d8 commit 84824b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
7 changes: 2 additions & 5 deletions node_package/src/clientStartup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
9 changes: 2 additions & 7 deletions node_package/src/handleError.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

0 comments on commit 84824b1

Please sign in to comment.