exitcode

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exitcode maps errors to the process exit codes documented in Spec 01 — Exit codes. Lower layers return plain or sentinel errors; the cmd boundary annotates them with a code via Wrap, and cmd/heraut resolves the final code via Resolve. This package is a leaf — it imports nothing from heraut.

Index

Constants

View Source
const (
	OK        = 0  // success
	Usage     = 1  // bad flags or arguments (also the default for unclassified errors)
	Config    = 2  // invalid YAML, missing required fields, semantic validation failure
	Runtime   = 3  // binary missing, token unset, network failure, git operation failed
	Promotion = 4  // promotion guard tripped (E001/E002/E003)
	Internal  = 70 // unexpected/internal condition
)

Exit codes per docs/specs/01-overview.md § Exit codes.

Variables

This section is empty.

Functions

func Resolve

func Resolve(err error) int

Resolve maps an error to an exit code: nil → OK, an error carrying an exit code → that code, anything else → Usage (heraut's historic exit-1 default).

func Wrap

func Wrap(code int, err error) error

Wrap annotates err with an exit code. It returns nil when err is nil. If err already carries an exit code (anywhere in its chain), the original code is preserved — the first/innermost classification wins.

Types

type Error

type Error struct {
	Code int
	Err  error
}

Error carries an exit code alongside an underlying error.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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