mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-11-04 15:00:11 +00:00
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:
1 parent
fae2608887
commit
eb261fd48b
1 file changed
+4
-5
+4
-5
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user