feat: smart error dispatch with inline Browser Bridge diagnosis#481
Merged
feat: smart error dispatch with inline Browser Bridge diagnosis#481
Conversation
- BrowserConnectError: runs checkDaemonStatus() on failure, shows real-time daemon/extension status and specific fix steps instead of a static hint - AuthRequiredError: domain-specific login guidance - TimeoutError: shows exact env var override command - SelectorError/EmptyResultError: flags adapter as potentially outdated, links to debug command and issue tracker - Generic untyped errors (164 in adapters): pattern-classified into auth/http/not-found/other with tailored guidance per category - BrowserConnectError gains a `kind` field for future dispatch - Added 6 new error icons (COMMAND_EXEC, ADAPTER_LOAD, NETWORK, etc.) - Updated test: invalid bool now rejected eagerly in commanderAdapter
- checkDaemonStatus: add { timeout: 300 } to match execution.ts behavior,
avoids 2s wait on an already-failed path
- catch block: use named _statusErr variable; fall back to kind-derived
state (running/extensionConnected inferred from BrowserConnectError.kind)
instead of re-accessing outer err.hint ambiguously
- Extract renderBridgeStatus() helper to share logic between real-time
and kind-derived fallback paths
- AuthRequiredError: use err.hint when set, respecting adapter-supplied
hints; fall back to generic domain-based guidance
- HTTP regex: broaden from 'http [45]xx' to also match 'status: 404',
bare '404', 'status 500', etc. — avoids false negatives
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
checkDaemonStatus()inline and shows real-time diagnosis with specific fix steps per scenario (daemon down / extension missing / both OK but failed)--verboseand issue trackerthrow new Error()in adapters: pattern-classified intoauth / http / not-found / otherwith tailored guidance per category — previously all fell through to bareError: xxxBrowserConnectErrorgains akindfield (daemon-not-running | extension-not-connected | command-failed | unknown) for cleaner dispatchERROR_ICONSentries (COMMAND_EXEC,ADAPTER_LOAD,NETWORK,API_ERROR,RATE_LIMITED,PAGE_CHANGED,CONFIG)commanderAdapterrather than passed through toexecution.tsTest plan
opencli bilibili hotwith extension not installed → shows daemon/extension status + install stepsopencli bilibili hotwith daemon not running → shows "run again, auto-start" messagethrow new Error('HTTP 403 Hint: Not logged in?')→ shows 🔒 + login hintopencli bilibili hotwith unknown selector → shows 🔍 + adapter outdated hint + issue link