Fix timeout error messages in JavaScript client#66
Open
evanniedojadlo wants to merge 1 commit intoVibiumDev:mainfrom
Open
Fix timeout error messages in JavaScript client#66evanniedojadlo wants to merge 1 commit intoVibiumDev:mainfrom
evanniedojadlo wants to merge 1 commit intoVibiumDev:mainfrom
Conversation
The BiDi client was failing to properly handle error responses from
custom vibium: commands, resulting in "[object Object]: undefined"
error messages instead of helpful timeout messages.
The issue was that error responses can come in two formats:
1. Flat format (BiDi spec): { error: "code", message: "msg" }
2. Nested format (current impl): { error: { error: "code", message: "msg" } }
Browser-native BiDi errors use the flat format, while custom vibium:
commands currently send the nested format.
This fix updates the JavaScript client to handle both formats correctly,
ensuring that timeout errors display helpful messages like:
"timeout: Timeout after 1000ms waiting for '#selector': element not found"
Fixes: tests/js/auto-wait.test.js timeout tests now pass
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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