Documentation
¶
Index ¶
- Variables
- func ExitCode(err error) (int, bool)
- func HintOf(err error) string
- func IsUsage(err error) bool
- func MarkAs(kind error, format string, a ...any) error
- func Passthrough(err error, what string) error
- func Prompt(err error, format string, a ...any) error
- func Usage(err error) error
- func WithExitCode(code int) error
- func WithHint(err error, hint string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidInput indicates invalid user input. ErrInvalidInput = errors.New("invalid input") // ErrAuthFailed indicates an authentication operation failed. ErrAuthFailed = errors.New("authentication failed") // ErrNotFound indicates a requested resource was not found. ErrNotFound = errors.New("not found") // ErrForbidden indicates access to a resource is forbidden. ErrForbidden = errors.New("forbidden") )
var ErrCancelled = errors.New("cancelled")
ErrCancelled marks a deliberate user cancellation, such as choosing Cancel from a menu; it exits 0 silently.
Functions ¶
func Passthrough ¶
Passthrough converts a child process's non-zero exit into a bare exit-code error (the child already printed its own failure); other errors are wrapped with context. Signal-terminated processes have no usable exit status and are wrapped rather than converted.
func Prompt ¶
Prompt classifies a failed huh prompt. Ctrl-C at a prompt surfaces as huh.ErrUserAborted (the form runs in raw mode, so no SIGINT is delivered); it is treated like any other interrupt and exits 130. Anything else, such as no terminal being available, is a real failure and is reported with context rather than being mistaken for a cancellation.
func WithExitCode ¶
WithExitCode requests a silent exit with code, for a child that reported its own failure.
Types ¶
This section is empty.