exitcode

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package exitcode defines the mkit CLI exit-code contract and maps errors to exit codes. Keep in sync with the root command help text in cmd/mkit/main.go.

Index

Constants

View Source
const (
	// Success means the command completed without error.
	Success = 0
	// PolicyDeny means a governance policy blocked the requested action.
	PolicyDeny = 1
	// Usage means the command was invoked with invalid flags or arguments.
	Usage = 2
	// Runtime means the command failed for an operational reason
	// (I/O, engine, provider failures).
	Runtime = 3
)

mkit exit codes. Documented in the root command help.

Variables

This section is empty.

Functions

func CodeFor

func CodeFor(err error) int

CodeFor maps an error to the mkit exit code.

func IsUsageError

func IsUsageError(err error) bool

IsUsageError reports whether err was caused by invalid CLI usage.

func UsageErrorf

func UsageErrorf(format string, args ...any) error

UsageErrorf returns an error that maps to the Usage exit code.

Types

type UsageError

type UsageError struct {
	Err error
}

UsageError marks errors caused by invalid CLI usage (bad flags or arguments). The CLI exits with code Usage for these.

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