Skip to content

Commit

Permalink
fix: Update error message to include node type as per other checks
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolateboy committed Dec 30, 2024
1 parent 182caf7 commit 8628617
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/happy-dom/src/query-selector/QuerySelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export default class QuerySelector {
}

if (typeof selector === 'symbol') {
throw new window.TypeError(`Cannot convert a Symbol value to a string`);
throw new window.TypeError(
`Failed to execute 'querySelectorAll' on '${node.constructor.name}': Cannot convert a Symbol value to a string`
);
}

selector = String(selector);
Expand Down Expand Up @@ -212,7 +214,9 @@ export default class QuerySelector {
}

if (typeof selector === 'symbol') {
throw new window.TypeError(`Cannot convert a Symbol value to a string`);
throw new window.TypeError(
`Failed to execute 'querySelector' on '${node.constructor.name}': Cannot convert a Symbol value to a string`
);
}

selector = String(selector);
Expand Down

0 comments on commit 8628617

Please sign in to comment.