Skip to content

Fix #64: Improve timeout error messages in find()#76

Open
bluerook2000 wants to merge 1 commit intoVibiumDev:mainfrom
bluerook2000:fix/issue-64-timeout-error-messages
Open

Fix #64: Improve timeout error messages in find()#76
bluerook2000 wants to merge 1 commit intoVibiumDev:mainfrom
bluerook2000:fix/issue-64-timeout-error-messages

Conversation

@bluerook2000
Copy link
Copy Markdown

Summary

Fixes #64 — timeout errors from find() were showing as [object Object]: undefined instead of helpful messages.

Changes

1. clients/javascript/src/bidi/client.ts

  • handleResponse(): Safely stringify response.error and response.message fields that may not be strings, preventing the [object Object]: undefined output.

2. clients/javascript/src/vibe.ts

  • find(): Catch BiDi errors and re-throw as TimeoutError (from utils/errors.ts) when the error indicates a timeout or missing element. This produces clear messages like:
    TimeoutError: Timeout after 1000ms waiting for '#does-not-exist': ...
    

Testing

  • TypeScript compiles cleanly (tsc --noEmit)
  • Build succeeds (npm run build)
  • The two failing tests (find() times out for non-existent element and timeout error message is clear) should now pass since:
    • Error messages include "timeout" (matching the /timeout/i regex)
    • Error messages include the selector (matching the includes('#nonexistent-element-xyz') check)

Two changes:

1. BiDi client handleResponse: Safely stringify error/message fields
   that may not be strings, preventing '[object Object]: undefined'

2. Vibe.find(): Catch BiDi errors and re-throw as TimeoutError with
   the selector, timeout duration, and original error message. This
   gives users clear, actionable error messages like:
   'Timeout after 1000ms waiting for "#does-not-exist": ...'
   instead of the unhelpful '[object Object]: undefined'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-wait timeout tests failing with unhelpful error messages

1 participant