Documentation
¶
Index ¶
- Constants
- type Error
- func AsError(err error) *Error
- func ErrAPI(status int, msg string) *Error
- func ErrAmbiguous(msg string) *Error
- func ErrAuth(msg string) *Error
- func ErrDAVNotConfigured() *Error
- func ErrForbidden(msg string) *Error
- func ErrNetwork(cause error) *Error
- func ErrNotFound(resource, identifier string) *Error
- func ErrNotFoundHint(resource, identifier, hint string) *Error
- func ErrRateLimit(retryAfter int) *Error
- func ErrUsage(msg string) *Error
- func FromHTTPStatus(status int, body string) *Error
Constants ¶
View Source
const ( ExitOK = 0 ExitUsage = 1 ExitNotFound = 2 ExitAuth = 3 ExitForbid = 4 ExitRate = 5 ExitNetwork = 6 ExitAPI = 7 ExitAmbig = 8 )
Exit codes follow a shared rubric across CLI tools.
View Source
const ( CodeUsage = "usage" CodeNotFound = "not_found" CodeAuth = "auth" CodeForbid = "forbidden" CodeRate = "rate_limit" CodeNetwork = "network" CodeAPI = "api" CodeAmbig = "ambiguous" )
Error code strings.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"error"`
Hint string `json:"hint,omitempty"`
HTTPStatus int `json:"-"`
Retryable bool `json:"-"`
Cause error `json:"-"`
}
Error is a structured CLI error with code, message, hint, and optional cause.
func ErrAmbiguous ¶
func ErrDAVNotConfigured ¶
func ErrDAVNotConfigured() *Error
func ErrForbidden ¶
func ErrNetwork ¶
func ErrNotFound ¶
func ErrNotFoundHint ¶
func ErrRateLimit ¶
func FromHTTPStatus ¶
FromHTTPStatus creates the appropriate Error from an HTTP status code.
Click to show internal directories.
Click to hide internal directories.