errors

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSystem

func IsSystem(err error) bool

IsSystem reports whether err (or any error in its chain) is a SystemError.

func IsUsage

func IsUsage(err error) bool

IsUsage reports whether err (or any error in its chain) is a UsageError.

func Wrap

func Wrap(msg string) error

WrapSystem returns an error wrapping msg with a SystemError sentinel. Use IsSystem to test whether an error (or any error in its chain) is a SystemError.

func WrapF

func WrapF(format string, args ...interface{}) error

WrapF returns an error wrapping fmt.Sprintf(format, args...) with a SystemError sentinel.

func WrapUsage

func WrapUsage(err error) error

WrapUsage returns an error wrapping err with a UsageError sentinel. Use IsUsage to test whether an error (or any error in its chain) is a UsageError.

Types

type SystemError

type SystemError struct {
	Msg string
}

SystemError is a sentinel error type for system-level failures that should result in exit code 3. These include config file permission errors, network timeouts, and other infrastructure-level problems (as opposed to user errors which return exit code 1 or 2).

func (*SystemError) Error

func (e *SystemError) Error() string

type UsageError

type UsageError struct {
	Err error
}

UsageError is a sentinel error type for usage errors that should result in exit code 2. These include unknown flags, unknown subcommands, and other command-line syntax errors (as opposed to runtime errors which return exit code 1).

func (*UsageError) Error

func (e *UsageError) Error() string

func (*UsageError) Unwrap

func (e *UsageError) Unwrap() error

Jump to

Keyboard shortcuts

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