Fix timeout error messages in JavaScript client #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #64 - Two tests in
tests/js/auto-wait.test.jswere failing because timeout errors displayed as[object Object]: undefinedinstead of helpful error messages liketimeout: Timeout after 1000ms waiting for '#selector': element not found.In Vibium fashion, I leveraged Claude Code to identify and address this issue, then personally tested and verified the fixes on macOS 26.1.
The Issue
When
find()timed out looking for a non-existent element, the error message was completely unhelpful:Instead of something like:
Failing tests:
find()times out for non-existent elementRoot Cause
The BiDi client was attempting to create error messages by directly stringifying the error response, but error responses can come in two different formats:
{ error: "timeout", message: "Timeout after 1s..." }{ error: { error: "timeout", message: "..." } }vibium:commandsThe client was only handling the flat format, causing the nested format to stringify as
[object Object].The Fix
Updated the JavaScript BiDi client to detect and handle both error response formats:
Key changes in
clients/javascript/src/bidi/client.ts:Updated TypeScript types in
clients/javascript/src/bidi/types.ts:Test Plan
All 5 auto-wait tests now pass:
find()waits for element to appearclick()waits for element to be actionablefind()times out for non-existent elementTesting with Claude Code
To verify the fix:
Run the failing tests:
You should see all 5 tests pass with proper error messages displayed when timeouts occur.
Claude Code prompts for testing:
Files Changed
clients/javascript/src/bidi/client.ts- Added error format detection logicclients/javascript/src/bidi/types.ts- Updated TypeScript types to support both formats🤖 Generated with Claude Code