Skip to content

Commit eb261fd

Browse files
authored
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.
1 parent fae2608 commit eb261fd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/McpContext.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,10 @@ export class McpContext implements Context {
199199
this.logger('no cdpBackendNodeId');
200200
return;
201201
}
202-
if (this.#textSnapshot === null)
203-
throw new Error(
204-
"The snapshot is not defined, can't resolve backendNodeId: " +
205-
cdpBackendNodeId,
206-
);
202+
if (this.#textSnapshot === null) {
203+
this.logger('no text snapshot');
204+
return;
205+
}
207206
// TODO: index by backendNodeId instead.
208207
const queue = [this.#textSnapshot.root];
209208
while (queue.length) {

0 commit comments

Comments
 (0)