clierror

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var ErrCancelled = errors.New("cancelled")

ErrCancelled marks a deliberate user cancellation, such as choosing Cancel from a menu; it exits 0 silently.

Functions

func ExitCode

func ExitCode(err error) (int, bool)

func HintOf

func HintOf(err error) string

func IsUsage

func IsUsage(err error) bool

func MarkAs

func MarkAs(kind error, format string, a ...any) error

func Passthrough

func Passthrough(err error, what string) error

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.

func Prompt

func Prompt(err error, format string, a ...any) error

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 Usage

func Usage(err error) error

func WithExitCode

func WithExitCode(code int) error

func WithHint

func WithHint(err error, hint string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL