feat: Add structured error constructors for clearer messages#11
Merged
Conversation
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>
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
internal/errors/for common error patternsfmt.Errorfcalls inselector.goandcli.goto use structured errorsChanges
New error constructors in
internal/errors/errors.go:InvalidFlagValue: Shows allowed values when user provides invalid CLI flagInvalidSelection: Guides user when they enter non-numeric input in selectionSelectionOutOfRange: Shows valid range when selection number is out of boundsNoItemsAvailable: When a selection list is emptyWorkspaceAlreadyExists: Shows how to remove existing workspaceInvalidRepoName: For empty/invalid repository namesFailedToReadInput: For terminal input failuresConverted errors in CLI:
selector.go: All 4 user-facing errors now use structured constructorscli.go: Invalid--mq-trackand--mq-enabledvaluescli.go: Daemon communication errors (4 instances)cli.go: Workspace already exists errorcli.go: Invalid repository name errorTest plan
go build ./...passesgo test ./internal/errors/... ./internal/cli/...passesmulticlaude config --mq-enabled=invalidand verify helpful errorContext
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