chore(cmd): improves error messaging across the board

This commit is contained in:
Lewis Wynne 2025-12-17 14:49:24 +00:00
parent def2941128
commit fcae0bd4df
6 changed files with 37 additions and 47 deletions

View file

@ -46,9 +46,9 @@ const (
func (err errNotFound) Error() string {
if len(err.suggestions) == 0 {
return "no suggestions found"
return "No such key"
}
return fmt.Sprintf("did you mean %q", strings.Join(err.suggestions, ", "))
return fmt.Sprintf("No such key. Did you mean '%s'?", strings.Join(err.suggestions, ", "))
}
type Store struct{}
@ -189,7 +189,7 @@ func (s *Store) parseDB(v string, defaults bool) (string, error) {
if defaults {
return "default", nil
}
return "", fmt.Errorf("bad db format, use DB or @DB")
return "", fmt.Errorf("cannot parse db: bad db format, use DB or @DB")
}
return strings.ToLower(db), nil
}