Documentation
¶
Overview ¶
Package errors provides the AppError type used throughout invgate-cli for structured error handling with HTTP status codes, verbose context, and stdlib errors.Is/As compatibility.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
FormatError renders an AppError for stderr output. When verbose is true the Verbose map is appended.
Types ¶
type AppError ¶
type AppError struct {
Code int // HTTP status code (0 for non-HTTP errors)
Message string // User-facing message
Cause error // Wrapped underlying error (supports errors.Unwrap)
Verbose map[string]any // Extra context printed only with --verbose
}
AppError is the canonical error type carrying an HTTP status code, a human-readable message, an optional wrapped cause, and a verbose context map printed only when --verbose is active.
func (*AppError) Unwrap ¶
Unwrap returns the wrapped cause so errors.Is and errors.As traverse the error chain.
func (*AppError) VerboseOutput ¶
VerboseOutput renders the verbose context as a multi-line string. Keys are sorted alphabetically for deterministic output.