Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
fix: catch and log errors thrown when calling React.findDOMNode (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
chimericdream authored and stephenmathieson committed Jun 6, 2019
1 parent 7dffa7b commit 14eeec6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,20 @@ function checkAndReport(node, timeout) {
}

function checkNode(component) {
var node = ReactDOM.findDOMNode(component);
var node = null;

try {
node = ReactDOM.findDOMNode(component);
} catch (e) {
console.group('%caXe error: could not check node', critical);
console.group('%cComponent', serious);
console.error(component);
console.groupEnd();
console.group('%cError', serious);
console.error(e);
console.groupEnd();
console.groupEnd();
}

if (node) {
checkAndReport(node, timeout);
Expand Down

0 comments on commit 14eeec6

Please sign in to comment.