Skip to content

feat: refine error handling with semantic error types#312

Merged
jackwener merged 1 commit intomainfrom
feat/error-refinement
Mar 23, 2026
Merged

feat: refine error handling with semantic error types#312
jackwener merged 1 commit intomainfrom
feat/error-refinement

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Add 5 new CliError subclasses: AuthRequiredError, TimeoutError, ArgumentError, EmptyResultError, SelectorError
  • Centralize getErrorMessage() and ERROR_ICONS in errors.ts (eliminates 5 duplicate definitions)
  • Data-driven error rendering in commanderAdapter.ts (replaces 5 if/else branches)
  • withTimeoutMs accepts factory function for backward compatibility
  • browser/errors.ts returns BrowserConnectError instead of bare Error
  • Migrate 5 benchmark adapters to AuthRequiredError

Testing

  • 33 test files, 318 unit tests passing, 0 regressions
  • New errors.test.ts covers all 9 error types

Files changed (14)

errors.ts, browser/errors.ts, runtime.ts, execution.ts, commanderAdapter.ts, discovery.ts, validate.ts, build-manifest.ts, errors.test.ts, + 5 adapter migrations

- Add 5 new CliError subclasses: AuthRequiredError, TimeoutError,
  ArgumentError, EmptyResultError, SelectorError
- Centralize getErrorMessage() and ERROR_ICONS in errors.ts
- Data-driven error rendering in commanderAdapter.ts (replaces 5 if/else)
- withTimeoutMs accepts factory function for backward compatibility
- browser/errors.ts returns BrowserConnectError instead of bare Error
- Migrate 5 benchmark adapters to AuthRequiredError
- 318 unit tests passing, 0 regressions
@jackwener jackwener merged commit b4d64ca into main Mar 23, 2026
10 of 11 checks passed
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.

1 participant