exitcode

package
v0.82.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 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. The mechanism (ExitError, Wrap, Resolve) now lives in forge; this package keeps heraut's code values and delegates the plumbing, so lower layers still classify via Wrap and cmd/heraut resolves via Resolve.

Index

Constants

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

Exit codes per docs/specs/01-overview.md § Exit codes. The generic codes are re-exported from forge's shared vocabulary (ADR-0003); Promotion is heraut's own domain code in the reserved 4-69 range.

Variables

This section is empty.

Functions

func Resolve

func Resolve(err error) int

Resolve maps an error to an exit code: nil → OK, a coded error → 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; the first/innermost classification wins.

func WrapSummary added in v0.59.0

func WrapSummary(code int, err error, summary string) error

WrapSummary annotates err with an exit code and a short display summary, while keeping err reachable via Unwrap for errors.Is/errors.As classification — use it at a boundary where the full error was already shown elsewhere (e.g. a step reporter) so the top-level error display doesn't repeat it. Like Wrap, the first/innermost classification wins.

Types

This section is empty.

Jump to

Keyboard shortcuts

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