Documentation
¶
Overview ¶
Package errors provides SDK error types without CLI-specific hints. The CLI layer wraps these with user-facing hints.
Index ¶
- Constants
- func ExitCodeFor(code string) int
- type Error
- func ErrAPI(status int, msg string) *Error
- func ErrAmbiguous(resource string, matches []string) *Error
- func ErrAuth(msg string) *Error
- func ErrForbidden(msg string) *Error
- func ErrNetwork(cause error) *Error
- func ErrNotFound(resource, identifier string) *Error
- func ErrRateLimit(retryAfter int) *Error
- func ErrUsage(msg string) *Error
Constants ¶
View Source
const ( CodeUsage = "usage" CodeNotFound = "not_found" CodeAuth = "auth_required" CodeForbidden = "forbidden" CodeRateLimit = "rate_limit" CodeNetwork = "network" CodeAPI = "api_error" CodeAmbiguous = "ambiguous" )
Error codes.
View Source
const ( ExitOK = 0 // Success ExitUsage = 1 // Invalid arguments or flags ExitNotFound = 2 // Resource not found ExitAuth = 3 // Not authenticated ExitForbidden = 4 // Access denied (scope issue) ExitRateLimit = 5 // Rate limited (429) ExitNetwork = 6 // Connection/DNS/timeout error ExitAPI = 7 // Server returned error ExitAmbiguous = 8 // Multiple matches for name )
Exit codes.
Variables ¶
This section is empty.
Functions ¶
func ExitCodeFor ¶
ExitCodeFor returns the exit code for a given error code.
Types ¶
type Error ¶
type Error struct {
Code string // Error code (e.g., "not_found", "auth_required")
Message string // Error message
HTTPStatus int // HTTP status code if applicable
Retryable bool // Whether the operation can be retried
Cause error // Underlying error
}
Error is a structured error for SDK operations. Unlike output.Error, it does not contain CLI-specific hints.
func ErrAmbiguous ¶
ErrAmbiguous creates an ambiguous match error.
func ErrNotFound ¶
ErrNotFound creates a not found error.
func ErrRateLimit ¶
ErrRateLimit creates a rate limit error.
Click to show internal directories.
Click to hide internal directories.