Skip to content

Commit a9db3e1

Browse files
dx: better error logging
1 parent 2542c6a commit a9db3e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/click-to-react-component/src/getSourceForElement.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export function getSourceForElement(
2222

2323
function getFirstParentElementWithSource(element) {
2424
const parentElement = element.parentElement
25-
if (parentElement === null) throw new Error('No parent found')
25+
if (parentElement === null) {
26+
console.warn("Couldn't find a React instance for the element", element)
27+
throw new Error('No parent found for element')
28+
}
2629

2730
const instance = getReactInstanceForElement(parentElement)
2831
const source = getSourceForInstance(instance)

0 commit comments

Comments
 (0)