Documentation
¶
Index ¶
Constants ¶
View Source
const ( ExitSuccess = 0 ExitGeneralError = 1 ExitBadArguments = 2 ExitAuthError = 3 ExitAPIError = 4 ExitNotFound = 5 ExitCancelled = 6 ExitValidationFail = 7 ExitTimeout = 8 )
Exit code constants. Document new codes here before using them. Keep in sync with the exit code table in CLAUDE.md.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIError ¶
type CLIError struct {
Code string // machine-readable identifier, e.g. "auth.token_missing"
Title string // short label, e.g. "Authentication required"
Message string // full explanation
Suggestions []string // actionable next steps
Ref string // documentation URL, may be empty
ExitCode int // which exit code to use; defaults to ExitGeneralError
}
CLIError is the structured error type used throughout the CLI. Every error surfaced to the user must carry all fields.
func (*CLIError) Format ¶
Format renders the error for display on stderr. Output is intentionally multi-line so suggestions are readable.
func (*CLIError) FormatJSON ¶
FormatJSON renders the error as a JSON object for stderr when --json is active. Consumers can detect errors by checking for the "error": true field.
func (*CLIError) WithExitCode ¶
WithExitCode returns a copy of the error with the given exit code.
func (*CLIError) WithSuggestions ¶
WithSuggestions returns a copy of the error with suggestions appended.
Click to show internal directories.
Click to hide internal directories.