From 86286172790f54959cc5440c7b0b4efdb43a86e0 Mon Sep 17 00:00:00 2001 From: chocolateboy Date: Mon, 30 Dec 2024 20:53:39 +0000 Subject: [PATCH] fix: Update error message to include node type as per other checks --- packages/happy-dom/src/query-selector/QuerySelector.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/happy-dom/src/query-selector/QuerySelector.ts b/packages/happy-dom/src/query-selector/QuerySelector.ts index 2c2504b6..a6d42875 100644 --- a/packages/happy-dom/src/query-selector/QuerySelector.ts +++ b/packages/happy-dom/src/query-selector/QuerySelector.ts @@ -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); @@ -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);