Documentation
¶
Overview ¶
Package errors defines the CLIError type used across all jira-cli commands. Every command returns errors (never os.Exit); main.go renders them.
Index ¶
- type CLIError
- func NewAmbiguousUserError(message string, matches []map[string]interface{}) *CLIError
- func NewAuthError(message string) *CLIError
- func NewConflictError(message string) *CLIError
- func NewGeneralError(message string) *CLIError
- func NewMissingFieldError(field, issueType string) *CLIError
- func NewNetworkError(message string, instance string) *CLIError
- func NewNotFoundError(message string, key string) *CLIError
- func NewPermissionError(message string) *CLIError
- func NewRateLimitError(message string) *CLIError
- func NewTransitionError(message string, available []map[string]interface{}) *CLIError
- func NewUnknownTypeError(message string) *CLIError
- func NewValidationError(message string) *CLIError
- type ErrorCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIError ¶
type CLIError struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Context map[string]interface{} `json:"context,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
ExitCode int `json:"-"`
Err error `json:"-"`
}
CLIError is a structured error carrying machine-readable code, context, and an actionable suggestion for self-correction by humans and agents.
func NewAmbiguousUserError ¶
NewAmbiguousUserError creates an AMBIGUOUS_USER (exit 3) with match candidates.
func NewAuthError ¶
NewAuthError creates an AUTH_ERROR (exit 2).
func NewConflictError ¶
NewConflictError creates a CONFLICT_ERROR (exit 8).
func NewGeneralError ¶
NewGeneralError creates a GENERAL_ERROR (exit 1).
func NewMissingFieldError ¶
NewMissingFieldError creates a MISSING_FIELD (exit 3) with field and type context.
func NewNetworkError ¶
NewNetworkError creates a NETWORK_ERROR (exit 7) with instance context.
func NewNotFoundError ¶
NewNotFoundError creates a NOT_FOUND (exit 4) with optional key context.
func NewPermissionError ¶
NewPermissionError creates a PERMISSION_DENIED (exit 5).
func NewRateLimitError ¶
NewRateLimitError creates a RATE_LIMITED (exit 6).
func NewTransitionError ¶
NewTransitionError creates an INVALID_TRANSITION (exit 3) with available transitions.
func NewUnknownTypeError ¶
NewUnknownTypeError creates an UNKNOWN_TYPE (exit 3).
func NewValidationError ¶
NewValidationError creates a VALIDATION_ERROR (exit 3).
func (*CLIError) MarshalJSON ¶
MarshalJSON produces {"error": {"code": "...", "message": "...", ...}}.
func (*CLIError) WithContext ¶
WithContext returns the error with the given context map.
func (*CLIError) WithSuggestion ¶
WithSuggestion returns the error with an actionable suggestion.
type ErrorCode ¶
type ErrorCode string
ErrorCode is a machine-readable string identifying the error category.
const ( GENERAL_ERROR ErrorCode = "GENERAL_ERROR" AUTH_ERROR ErrorCode = "AUTH_ERROR" VALIDATION_ERROR ErrorCode = "VALIDATION_ERROR" NOT_FOUND ErrorCode = "NOT_FOUND" PERMISSION_DENIED ErrorCode = "PERMISSION_DENIED" RATE_LIMITED ErrorCode = "RATE_LIMITED" INVALID_TRANSITION ErrorCode = "INVALID_TRANSITION" MISSING_FIELD ErrorCode = "MISSING_FIELD" UNKNOWN_TYPE ErrorCode = "UNKNOWN_TYPE" AMBIGUOUS_USER ErrorCode = "AMBIGUOUS_USER" NETWORK_ERROR ErrorCode = "NETWORK_ERROR" CONFLICT_ERROR ErrorCode = "CONFLICT_ERROR" )