Skip to content

fix: improve ~40 terse error messages with actionable guidance#80

Open
marcus wants to merge 1 commit intomainfrom
error-msg-improve
Open

fix: improve ~40 terse error messages with actionable guidance#80
marcus wants to merge 1 commit intomainfrom
error-msg-improve

Conversation

@marcus
Copy link
Copy Markdown
Owner

@marcus marcus commented Mar 26, 2026

Summary

  • Improved ~40 terse, unhelpful fmt.Errorf() return values across 10 files in the CLI layer
  • Each error now includes actionable guidance: the failing value where applicable and the remediation command
  • Sentinel errors in syncclient (ErrUnauthorized, ErrForbidden, ErrNotFound) now include descriptive context

Files changed

  • cmd/project.go — 7x "not authenticated", 4x "not linked", 1x "no projects found", 1x "invalid selection"
  • cmd/sync.go — 1x "not authenticated", 1x "not linked"
  • cmd/sync_init.go — 1x "not authenticated", 1x "project name required", 1x "no projects found", 1x "invalid selection"
  • cmd/create.go — 1x "title is required", 1x "invalid points"
  • cmd/ws.go — 1x "work session already active", 5x "no active work session"
  • cmd/show.go — 2x "issue ID required"
  • cmd/review.go — 1x "no issues specified", 1x "no issue specified"
  • cmd/autosync.go — 1x "unauthorized"
  • cmd/undo.go — 3x "no previous data to restore"
  • internal/syncclient/client.go — 3x sentinel error descriptions

Test plan

  • go build compiles successfully
  • go test ./cmd/... passes (existing tests use strings.Contains for substring matching)
  • go test ./internal/syncclient/... — no test files (sentinel errors tested via errors.Is elsewhere)
  • Manual: verify error messages render correctly in terminal

🤖 Generated with Claude Code


Automated by nightshift

Make returned errors self-contained and actionable — include the failing
value where applicable and suggest the remediation command. Users see
the returned error (shown by Cobra) last, so it needs to be helpful
on its own without the preceding output.Error() context.

Changes across 10 files:
- "not authenticated" → includes "run td auth login"
- "not linked" → includes "run td sync-project link <id>"
- "invalid selection" → includes valid range
- "no projects found" → suggests creation command
- "no active work session" → suggests "td ws start <name>"
- "work session already active" → includes session name, suggests "td ws end"
- "issue ID required" → suggests "td list"
- "no issues specified" → suggests providing IDs or --all
- "title is required" → suggests argument or --title flag
- "invalid points" → includes the invalid value
- "no previous data to restore" → clearer "cannot undo" phrasing
- Sentinel errors (ErrUnauthorized, ErrForbidden, ErrNotFound) → descriptive

Nightshift-Task: error-msg-improve
Nightshift-Ref: https://github.com/marcus/nightshift

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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