Skip to content

feat: Add structured error constructors for clearer messages#11

Merged
whitmo merged 1 commit intomainfrom
work/fancy-platypus
Feb 25, 2026
Merged

feat: Add structured error constructors for clearer messages#11
whitmo merged 1 commit intomainfrom
work/fancy-platypus

Conversation

@whitmo
Copy link
Copy Markdown
Owner

@whitmo whitmo commented Feb 3, 2026

Summary

  • Adds 7 new error constructors to internal/errors/ for common error patterns
  • Converts raw fmt.Errorf calls in selector.go and cli.go to use structured errors
  • Every converted error now includes actionable suggestions for users

Changes

New error constructors in internal/errors/errors.go:

  • InvalidFlagValue: Shows allowed values when user provides invalid CLI flag
  • InvalidSelection: Guides user when they enter non-numeric input in selection
  • SelectionOutOfRange: Shows valid range when selection number is out of bounds
  • NoItemsAvailable: When a selection list is empty
  • WorkspaceAlreadyExists: Shows how to remove existing workspace
  • InvalidRepoName: For empty/invalid repository names
  • FailedToReadInput: For terminal input failures

Converted errors in CLI:

  • selector.go: All 4 user-facing errors now use structured constructors
  • cli.go: Invalid --mq-track and --mq-enabled values
  • cli.go: Daemon communication errors (4 instances)
  • cli.go: Workspace already exists error
  • cli.go: Invalid repository name error

Test plan

  • go build ./... passes
  • go test ./internal/errors/... ./internal/cli/... passes
  • Manual: Run multiclaude config --mq-enabled=invalid and verify helpful error

Context

Addresses ROADMAP.md P0 item: "Clear error messages: Every failure should tell the user what went wrong and how to fix it"

🤖 Generated with Claude Code

Adds new error constructors to internal/errors/:
- InvalidFlagValue: for invalid CLI flag values with allowed options
- InvalidSelection/SelectionOutOfRange: for interactive selection errors
- NoItemsAvailable: when selection list is empty
- WorkspaceAlreadyExists: for duplicate workspace names
- InvalidRepoName: for empty/invalid repository names
- FailedToReadInput: for terminal input failures

Converts raw fmt.Errorf calls to use structured errors:
- selector.go: All user-facing errors now have suggestions
- cli.go: Invalid flag values use InvalidFlagValue constructor
- cli.go: Daemon communication errors use DaemonCommunicationFailed
- cli.go: Workspace/repo validation uses appropriate constructors

Every error now tells the user what went wrong and how to fix it.

Addresses ROADMAP.md P0 item: "Clear error messages"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@whitmo whitmo added the multiclaude PR managed by multiclaude label Feb 3, 2026
@whitmo whitmo merged commit 0f627a4 into main Feb 25, 2026
@whitmo whitmo deleted the work/fancy-platypus branch March 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multiclaude PR managed by multiclaude

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant