Skip to content

Chrome DevTools for coding agents

refactor: avoid throwing in resolveCdpElementId (#606)

Alex Rudenkoeb261fd48b67
diff --git a/src/McpContext.ts b/src/McpContext.ts
index 7536fe78..1b0c586f 100644
--- a/src/McpContext.ts
+++ b/src/McpContext.ts
@@ -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) {