Skip to content

Commit e71c427

Browse files
feat(getTarget): throw when string not in DOM (#622)
Previously it when a string target was not found in the DOM via querySelector, it would just return the `null` and bomb elswhere Now an error is thrown to help the developer track down the issue. Closes #620
1 parent 3fbd34c commit e71c427

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ export function getTarget(target) {
120120
if (selection === null) {
121121
return document.querySelector(`#${target}`);
122122
}
123+
if (selection === null) {
124+
throw new Error(`The target '${target}' could not be identified in the dom, tip: check spelling`);
125+
}
123126
return selection;
124127
}
125128

0 commit comments

Comments
 (0)