exitcode

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK           = 0
	ExitFailed       = 1
	ExitTimedOut     = 2
	ExitInvalidInput = 3
)

Constants for well-known exit codes used by the CLI.

Variables

This section is empty.

Functions

func InvalidInput

func InvalidInput(err error) error

InvalidInput wraps an error to signal exit code 3 (invalid input).

func Timeout

func Timeout(err error) error

Timeout wraps an error to signal exit code 2 (timeout).

Types

type ExitError

type ExitError struct {
	Code int   // process exit code
	Err  error // underlying error (optional)
}

ExitError carries an explicit process exit code along with an underlying error. It implements the error interface and supports errors.Unwrap.

func New

func New(code int, err error) *ExitError

New constructs a new ExitError with the given code and underlying error.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

Unwrap allows errors.Is / errors.As to inspect the underlying error.

Jump to

Keyboard shortcuts

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