Repository navigation
Conversation
|
/agentic_describe |
PR Summary by QodoThrow typed WebDriver errors from generated JavaScript BiDi modules
AI Description
Merge Risk
|
Code Review by Qodo
1. Unknown BiDi codes can get classic types
|
| const response = await this.#bidi.send({ method, params }) | ||
| if (response?.error !== undefined) { | ||
| throw new Error(`${response.error}: ${response.message}`) | ||
| const err = new WebDriverError(`${response.error}: ${response.message}`) |
There was a problem hiding this comment.
2. Subscription failures remain plain errors 🐞 Bug ≡ Correctness
Domain.send() now wraps wire-level failures in WebDriverError, but the inherited Domain.addCallback() path delegates subscription failures to Index.addCallback() and Index.removeCallback(), which still throw plain Error. A caller using a generated domain receives different error types for failed commands and failed subscriptions, even though both paths handle the same wire-error response shape.
Agent Prompt
## Issue description
Generated-domain commands now reject with `WebDriverError`, but subscription and unsubscription failures reached through the same domain still reject with plain `Error`.
## Fix Focus Areas
- javascript/selenium-webdriver/bidi/domain.js[61-69]
- javascript/selenium-webdriver/bidi/index.js[403-416]
- javascript/selenium-webdriver/bidi/index.js[467-478]
## Recommended Fix
Use a shared wire-error conversion for domain commands, subscription and unsubscription responses. Preserve the remote error code, message and string stacktrace in all three paths, and add tests for subscription failures.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const { error: code } = error.encodeError(new type()) | ||
| if (!typesByCode.has(code)) typesByCode.set(code, type) |
There was a problem hiding this comment.
1. Unknown bidi codes can get classic types 🐞 Bug ≡ Correctness
types() registers every classic WebDriver error code before checking which codes belong to the BiDi schema. If a remote end returns a code such as no such cookie, which is absent from BiDi's ErrorCode, Domain.send() throws NoSuchCookieError instead of the generic WebDriverError used for other unrecognized codes.
Agent Prompt
## Issue description
Classic-only error codes are registered as BiDi error types, so an unrecognized BiDi code can receive a misleading classic error class.
## Fix Focus Areas
- javascript/selenium-webdriver/bidi/error.js[26-40]
## Recommended Fix
Load the BiDi `ErrorCode` values before populating the map, and register classic error classes only when their encoded code is among those values. Continue defining dedicated classes for the remaining BiDi codes and using `WebDriverError` for codes outside the schema.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 39b6503 |
|
/agentic_review |
🔗 Related Issues
The BiDi low-level behavioral contract ADR says an error response must error for the reason the remote end provides, unrecognized error codes included.
💥 What does this PR do?
When a command fails, the generated JavaScript BiDi modules now throw a typed
WebDriverErrorfor the BiDi error code instead of a plainError.🤖 AI assistance
Domain#senderror change and tests🔄 Types of changes