Skip to content

refactor: use CliError subclasses in adapters (first batch)#365

Closed
jackwener wants to merge 2 commits intomainfrom
use-cli-errors
Closed

refactor: use CliError subclasses in adapters (first batch)#365
jackwener wants to merge 2 commits intomainfrom
use-cli-errors

Conversation

@jackwener
Copy link
Owner

Summary

Replace raw Error throws with appropriate CliError subclasses in several adapters. This enables better error handling and user-facing error messages through the framework's error rendering system.

Changes

LinkedIn adapters

  • linkedin/timeline.ts: AuthRequiredError, EmptyResultError
  • linkedin/search.ts: ArgumentError, CommandExecutionError

Twitter adapters

  • twitter/trending.ts: AuthRequiredError, EmptyResultError
  • twitter/bookmarks.ts: AuthRequiredError, CommandExecutionError

Reddit adapters

  • reddit/read.ts: CommandExecutionError for API-related errors

Impact

Before: Raw errors with generic messages
After: Structured errors with:

  • Machine-readable error codes
  • Consistent emoji-coded severity indicators
  • Actionable hints for users
  • Better categorization for error handling

Next Steps

This is a first batch covering high-usage adapters. ~120 more adapters still need similar treatment for consistency across the codebase.

Testing

  • Typecheck: ✅ Clean
  • Manual testing of modified commands

…ters

Replace raw Error throws with appropriate CliError subclasses:
- youtube/transcript.ts: CommandExecutionError, EmptyResultError
- youtube/video.ts: CommandExecutionError
- bilibili/utils.ts: EmptyResultError
- boss/send.ts: EmptyResultError, SelectorError
- boss/mark.ts: ArgumentError, EmptyResultError

This enables better error handling and user-facing error messages.
Replace raw Error throws with appropriate CliError subclasses:
- chatgpt/status.ts: ConfigError for platform limitation
- chatgpt/ask.ts: ConfigError for platform limitation
- chatgpt/new.ts: ConfigError for platform limitation
- chatgpt/read.ts: ConfigError for platform limitation, CommandExecutionError for read failures

This enables better error handling and user-facing error messages.
@jackwener
Copy link
Owner Author

Superseded by rebased version

@jackwener jackwener closed this Mar 24, 2026
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