exitcode

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package exitcode maps errors to the process exit codes documented in `fft help exit-codes`.

Index

Constants

View Source
const (
	OK          = 0 // success
	General     = 1 // unclassified failure
	Usage       = 2 // bad flags or arguments
	Config      = 3 // no active project, or the config is unusable
	Auth        = 4 // authentication failed (401)
	Forbidden   = 5 // authenticated but not permitted (403)
	NotFound    = 6 // the resource does not exist (404)
	Conflict    = 7 // optimistic-locking version conflict (409)
	Partial     = 8 // a bulk operation succeeded for some items and failed for others
	Unavailable = 9 // upstream is unreachable or erroring (5xx, timeout)
	Interrupted = 130
)

Exit codes. These are part of the CLI's contract with scripts — changing one is a breaking change.

Variables

This section is empty.

Functions

func FromError

func FromError(err error) int

FromError classifies an error into an exit code. Errors that implement ExitCode() decide for themselves; everything else is a general failure.

Types

type UsageError

type UsageError struct{ Err error }

UsageError marks an error as a usage problem so cobra's argument and flag validation surfaces as exit code 2 rather than a generic failure.

func (UsageError) Error

func (e UsageError) Error() string

func (UsageError) ExitCode

func (e UsageError) ExitCode() int

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