errors

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryable

func IsRetryable(err error) bool

IsRetryable determines if an error is retryable

func WrapAWSError

func WrapAWSError(err error, service, operation string) error

WrapAWSError wraps AWS SDK errors with appropriate custom error types

func WrapSystemError

func WrapSystemError(component string, err error) error

WrapSystemError wraps system-level errors

func WrapValidationError

func WrapValidationError(domain string, err error) error

WrapValidationError wraps domain validation errors

Types

type APIError

type APIError struct {
	*BaseError
	Service    string
	Operation  string
	RequestID  string
	StatusCode int
}

APIError represents AWS API call failures

func NewAPIError

func NewAPIError(service, operation, message string, cause error) *APIError

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) WithRequestID

func (e *APIError) WithRequestID(requestID string) *APIError

func (*APIError) WithStatusCode

func (e *APIError) WithStatusCode(statusCode int) *APIError

type AuthenticationError

type AuthenticationError struct {
	*BaseError
	Provider string
}

AuthenticationError represents AWS credential issues

func NewAuthenticationError

func NewAuthenticationError(provider, message string, cause error) *AuthenticationError

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

type AuthorizationError

type AuthorizationError struct {
	*BaseError
	Operation string
	Resource  string
}

AuthorizationError represents insufficient permissions

func NewAuthorizationError

func NewAuthorizationError(operation, resource, message string, cause error) *AuthorizationError

func (*AuthorizationError) Error

func (e *AuthorizationError) Error() string

type BaseError

type BaseError struct {
	Category ErrorCategory
	Message  string
	Cause    error
	Context  map[string]interface{}
}

BaseError provides common functionality for all custom errors

func (*BaseError) Error

func (e *BaseError) Error() string

func (*BaseError) GetCategory

func (e *BaseError) GetCategory() ErrorCategory

func (*BaseError) GetContext

func (e *BaseError) GetContext() map[string]interface{}

func (*BaseError) Unwrap

func (e *BaseError) Unwrap() error

type ErrorCategory

type ErrorCategory string

ErrorCategory represents different categories of errors

const (
	CategoryValidation     ErrorCategory = "VALIDATION"
	CategoryAuthentication ErrorCategory = "AUTHENTICATION"
	CategoryAuthorization  ErrorCategory = "AUTHORIZATION"
	CategoryAPI            ErrorCategory = "API"
	CategorySystem         ErrorCategory = "SYSTEM"
)

type ExitCode

type ExitCode int

ExitCode represents different exit codes for the CLI

const (
	ExitSuccess        ExitCode = 0 // Success (domain checked successfully)
	ExitValidation     ExitCode = 1 // Validation error (invalid domain format)
	ExitAuthentication ExitCode = 2 // Authentication error (AWS credentials issue)
	ExitAuthorization  ExitCode = 3 // Authorization error (insufficient permissions)
	ExitAPIError       ExitCode = 4 // API error (AWS service error)
	ExitSystemError    ExitCode = 5 // System error (unexpected error)
)

func GetExitCode

func GetExitCode(err error) ExitCode

GetExitCode returns the appropriate exit code for an error

type SystemError

type SystemError struct {
	*BaseError
	Component string
}

SystemError represents unexpected system errors

func NewSystemError

func NewSystemError(component, message string, cause error) *SystemError

func (*SystemError) Error

func (e *SystemError) Error() string

type ValidationError

type ValidationError struct {
	*BaseError
	Domain string
	Field  string
}

ValidationError represents domain validation failures

func NewValidationError

func NewValidationError(domain, field, message string, cause error) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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