errors

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeAuth          = "AUTH_ERROR"
	ErrCodeConfig        = "CONFIG_ERROR"
	ErrCodeValidation    = "VALIDATION_ERROR"
	ErrCodeNetwork       = "NETWORK_ERROR"
	ErrCodeAPI           = "API_ERROR"
	ErrCodeFileOperation = "FILE_ERROR"
	ErrCodeTimeout       = "TIMEOUT_ERROR"
	ErrCodeRateLimit     = "RATE_LIMIT_ERROR"
	ErrCodeNotFound      = "NOT_FOUND"
	ErrCodePermission    = "PERMISSION_ERROR"
)

Error codes

Variables

This section is empty.

Functions

func ExitWithError

func ExitWithError(err error)

ExitWithError prints an error message and exits with code 1

func GetExitCode

func GetExitCode(err error) int

GetExitCode returns appropriate exit code for error

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error is a not found error

func IsRetryableError

func IsRetryableError(err error) bool

IsRetryableError checks if an error is retryable

func WrapError

func WrapError(err error, message string) error

WrapError wraps an error with additional context

Types

type CLIError

type CLIError struct {
	Code    string
	Message string
	Cause   error
}

CLIError represents a CLI-specific error

func NewAPIError

func NewAPIError(message string, cause error) *CLIError

NewAPIError creates an API error

func NewAuthError

func NewAuthError(message string, cause error) *CLIError

NewAuthError creates an authentication error

func NewCLIError

func NewCLIError(code, message string, cause error) *CLIError

NewCLIError creates a new CLI error

func NewConfigError

func NewConfigError(message string, cause error) *CLIError

NewConfigError creates a configuration error

func NewFileError

func NewFileError(message string, cause error) *CLIError

NewFileError creates a file operation error

func NewNetworkError

func NewNetworkError(message string, cause error) *CLIError

NewNetworkError creates a network error

func NewNotFoundError

func NewNotFoundError(message string, cause error) *CLIError

NewNotFoundError creates a not found error

func NewPermissionError

func NewPermissionError(message string, cause error) *CLIError

NewPermissionError creates a permission error

func NewRateLimitError

func NewRateLimitError(message string, cause error) *CLIError

NewRateLimitError creates a rate limit error

func NewTimeoutError

func NewTimeoutError(message string, cause error) *CLIError

NewTimeoutError creates a timeout error

func NewValidationError

func NewValidationError(message string, cause error) *CLIError

NewValidationError creates a validation error

func (*CLIError) Error

func (e *CLIError) Error() string

func (*CLIError) Unwrap

func (e *CLIError) Unwrap() error

type ValidationError

type ValidationError struct {
	Field   string
	Value   interface{}
	Message string
}

ValidationError represents a field validation error

func (*ValidationError) Error

func (e *ValidationError) Error() string

type ValidationErrors

type ValidationErrors []ValidationError

ValidationErrors represents multiple validation errors

func (*ValidationErrors) AddValidationError

func (e *ValidationErrors) AddValidationError(field string, value interface{}, message string)

AddValidationError adds a validation error

func (ValidationErrors) Error

func (e ValidationErrors) Error() string

func (ValidationErrors) HasErrors

func (e ValidationErrors) HasErrors() bool

HasErrors returns true if there are validation errors

Jump to

Keyboard shortcuts

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