refactor: avoid throwing in resolveCdpElementId (#606)

We can return undefined as already supported by the function signature
so that the callers do not have to try/catch.
This commit is contained in:
Alex Rudenko authored and GitHub committed 2025-11-25 16:20:35 +01:00
1 parent fae2608887
commit eb261fd48b
1 file changed
+4 -5
+4 -5
View File
@@ -199,11 +199,10 @@ export class McpContext implements Context {
this.logger('no cdpBackendNodeId');
return;
}
if (this.#textSnapshot === null)
throw new Error(
"The snapshot is not defined, can't resolve backendNodeId: " +
cdpBackendNodeId,
);
if (this.#textSnapshot === null) {
this.logger('no text snapshot');
return;
}
// TODO: index by backendNodeId instead.
const queue = [this.#textSnapshot.root];
while (queue.length) {