Documentation
¶
Overview ¶
Package cerr holds the semantic error classification shared by the gorefactor CLI and its importable refactoring engines. It carries a stable exit code and optional "did you mean" candidate list so that agents can key retries off the exit code and callers can render candidates uniformly.
Index ¶
- Constants
- func Candidates(err error) []string
- func ClosestMatch(name string, candidates []string) string
- func ExitCodeFor(err error) int
- func Gatef(format string, a ...interface{}) error
- func NotFound(summary, name string, candidates []string) error
- func NotFoundf(format string, a ...interface{}) error
- func Parsef(format string, a ...interface{}) error
- func Usagef(format string, a ...interface{}) error
- type CLIError
Constants ¶
const ( ExitOK = 0 // success ExitUsage = 1 // usage / argument error ExitNotFound = 2 // target or pattern not found (semantic miss) ExitParseError = 3 // snippet or file does not parse ExitGateFailure = 4 // build/test gate failed (doctor, --gate) )
Semantic exit codes. Documented in the CLI usage; agents key retries off them.
Variables ¶
This section is empty.
Functions ¶
func Candidates ¶
Candidates extracts the candidate list from a CLIError, if any.
func ClosestMatch ¶
ClosestMatch returns the candidate with the smallest Levenshtein distance to name, when that distance is small enough to be a plausible typo.
func ExitCodeFor ¶
ExitCodeFor maps an error to its semantic exit code (default: usage error).
func NotFound ¶
NotFound builds an exit-2 error whose message lists the available candidates and, when one is close to name, a "did you mean" hint.