{"modulePath":"github.com/GSI-HPC/clusterctl","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package exitcode\n\nPackage exitcode defines the process exit codes clusterctl guarantees.\n\nThe codes are part of the command line contract: scripts branch on them, so they may be added to but never renumbered.\n\n## Constants\n\n```go\nconst (\n\t// OK means every target succeeded.\n\tOK = 0\n\t// TargetFailed means clusterctl ran correctly but at least one target\n\t// reported a failure.\n\tTargetFailed = 1\n\t// Usage means the command line or the configuration was rejected before\n\t// anything was contacted.\n\tUsage = 2\n\t// Transport means a host could not be reached, authenticated with, or\n\t// stayed reachable for the duration of the command.\n\tTransport = 3\n\t// Interrupted means the command was cancelled, by a signal or by a\n\t// declined confirmation prompt.\n\tInterrupted = 130\n)\n```\n\n## Functions\n\n```go\nfunc Class(err error) progress.Class\n```\nClass is the class of progress an error that fits none of the first rules of progress.Classify gets, the class of the exit code it asks for, as CodeClass tells. It is the fallback every Bus of clusterctl's is made with, progress.Options.Classify, so that a span ends as the command would exit.\n\n```go\nfunc CodeClass(code int) progress.Class\n```\nCodeClass is the class of work that failed with the exit code code: Transport is progress.ClassTransport, Usage progress.ClassUsage, Interrupted progress.ClassCanceled, and any other but OK, which is no failure, progress.ClassTarget.\n\n```go\nfunc Default(code int, err error) error\n```\nDefault gives an error the exit code code, unless it asks for one already.\n\n```go\nfunc From(err error) int\n```\nFrom reports the exit code an error should produce. Errors that carry no code of their own count as a target failure.\n\n```go\nfunc Has(err error) bool\n```\nHas reports whether an error says which exit code it asks for.\n\n```go\nfunc Worst(errs ...error) int\n```\nWorst reports the code a command exits with when it met every one of errs, as on several hosts. The first that applies wins: Interrupted, which a cancellation counts as however it was wrapped, then Transport, Usage and TargetFailed. It is OK when every error is nil.\n\n```go\nfunc Wrap(code int, err error) error\n```\nWrap attaches an exit code to an existing error, returning nil for nil.\n\n## Types\n\n```go\ntype Error struct {\n\tCode int\n\tErr  error\n}\n```\nError carries an exit code alongside an error. Commands return it to select an exit code other than TargetFailed.\n\n```go\nfunc Errorf(code int, format string, args ...any) *Error\n```\nErrorf builds an Error with a formatted message.\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\nfunc (e *Error) Unwrap() error\n```\n\n","path":"github.com/GSI-HPC/clusterctl/internal/exitcode","name":"exitcode","synopsis":"Package exitcode defines the process exit codes clusterctl guarantees.","isRedistributable":true}
