Documentation
¶
Index ¶
Constants ¶
View Source
const ( Success = 0 General = 1 Usage = 2 Authentication = 3 NotFound = 4 PermissionDenied = 5 RateLimited = 6 PartialFailure = 7 // Unsupported (8) is a policy refusal: the command is real and correctly // invoked, but the resolved credentials cannot reach the API that serves it. // Distinct from Usage (2) because 2 is also every cobra flag error, unknown // subcommand, missing URL and missing credential — so a wrapper script could // not tell "refused by policy on this credential" from "you invoked it // wrong", which is exactly the distinction a pipeline needs in order to // degrade rather than fail. Not NotFound (4) either: a script iterating // commands treats 4 as "no such object, carry on" and would swallow it. Unsupported = 8 )
Exit codes matching README documentation.
Variables ¶
This section is empty.
Functions ¶
func CodeFrom ¶
CodeFrom extracts the exit code from an error. If the error contains an *Error anywhere in its chain, that code is returned. Otherwise returns General (1).
func PartialOrPropagate ¶ added in v1.19.0
PartialOrPropagate maps a batch tally to an exit error:
- failed == 0 -> nil
- succeeded > 0 && failed > 0 -> PartialFailure (7) carrying msg + counts
- succeeded == 0 && failed > 0-> firstErr's exit code (propagated), or General
Types ¶
type Error ¶
type Error struct {
Code int
Message string
Err error // optional wrapped error
Hint string // optional one-line remediation, surfaced separately
Details map[string]any // optional structured extras for the JSON envelope
}
Error is an error that carries a specific exit code.
func (*Error) WithDetails ¶ added in v1.19.0
WithDetails attaches structured extras and returns e for chaining.
Click to show internal directories.
Click to hide internal directories.