errors

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeCommandNotFound    = "COMMAND_NOT_FOUND"
	CodeParamRequired      = "PARAM_REQUIRED"
	CodeParamInvalid       = "PARAM_INVALID"
	CodeInvalidParams      = "INVALID_PARAMS_JSON"
	CodeOperationCancelled = "OPERATION_CANCELLED"
)

User errors (CategoryUser → exit 1)

View Source
const (
	CodeServerError   = "SERVER_ERROR"
	CodeNetworkError  = "NETWORK_ERROR"
	CodeServerTimeout = "SERVER_TIMEOUT"
)

Server errors (CategoryServer → exit 2)

View Source
const (
	CodeAuthRequired     = "AUTH_REQUIRED"
	CodeAuthFailed       = "AUTH_FAILED"
	CodeTokenExpired     = "TOKEN_EXPIRED"
	CodeRefreshFailed    = "REFRESH_FAILED"
	CodePermissionDenied = "PERMISSION_DENIED"
)

Auth errors (CategoryAuth → exit 3)

View Source
const (
	CodeNotInitialized  = "NOT_INITIALIZED"
	CodeConfigInvalid   = "CONFIG_INVALID"
	CodeProfileNotFound = "PROFILE_NOT_FOUND"
)

Config errors (CategoryConfig → exit 4)

View Source
const (
	CodeRegistryBuildFailed = "REGISTRY_BUILD_FAILED"
	CodeFormatterError      = "FORMATTER_ERROR"
	CodeInternal            = "INTERNAL"
)

Internal errors (CategoryInternal → exit 5)

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

func Render

func Render(err error, verbose bool) string

Types

type CLIError

type CLIError struct {
	Category Category
	Code     string
	Message  string
	Detail   string
	Cause    error
}

func As

func As(err error) *CLIError

func New

func New(category Category, code, message string) *CLIError

func (*CLIError) Error

func (e *CLIError) Error() string

func (*CLIError) ExitCode

func (e *CLIError) ExitCode() int

func (*CLIError) IsRetryable

func (e *CLIError) IsRetryable() bool

IsRetryable reports whether retrying the operation that produced this error has a reasonable chance of succeeding. Only CategoryServer errors (transient network / backend 5xx) are considered retryable by default; user, auth, config and internal errors are not. Exposed on the envelope payload as the `retryable` field so Agents can decide whether to re-issue the command.

func (*CLIError) Unwrap

func (e *CLIError) Unwrap() error

type Category

type Category int
const (
	CategoryUser Category = iota
	CategoryServer
	CategoryAuth
	CategoryConfig
	CategoryInternal
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL