Documentation
¶
Index ¶
- func AdaptAWSError(err error) error
- func EnhanceAWSError(err error, operation string, resource string) error
- func FormatWithContext(err error, ctx ErrorContext) string
- func GetErrorDetails(err error) map[string]interface{}
- func IsAWSError(err error) bool
- func IsConfigError(err error) bool
- func IsFileError(err error) bool
- func IsNetworkError(err error) bool
- func IsRetriable(err error) bool
- func IsValidationError(err error) bool
- func PrintError(err error)
- func PrintErrorVerbose(err error)
- func PrintInfof(format string, args ...interface{})
- func PrintSuccessf(format string, args ...interface{})
- func PrintWarning(message string)
- func Wrapf(err error, format string, args ...interface{}) error
- type EnvyError
- func AWSError(message string) *EnvyError
- func ConfigError(message string) *EnvyError
- func FileError(message string) *EnvyError
- func NetworkError(message string) *EnvyError
- func New(code ErrorCode, message string) *EnvyError
- func ValidationError(message string) *EnvyError
- func Wrap(err error, code ErrorCode, message string) *EnvyError
- func WrapAWSError(err error, operation string, resource string) *EnvyError
- func WrapFileError(err error, filepath string) *EnvyError
- func WrapNetworkError(err error) *EnvyError
- func (e *EnvyError) Error() string
- func (e *EnvyError) Is(target error) bool
- func (e *EnvyError) Unwrap() error
- func (e *EnvyError) UserMessage() string
- func (e *EnvyError) WithCause(cause error) *EnvyError
- func (e *EnvyError) WithDetails(key string, value interface{}) *EnvyError
- func (e *EnvyError) WithRetriable(retriable bool) *EnvyError
- type ErrorAggregator
- type ErrorCode
- type ErrorContext
- type Formatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdaptAWSError ¶
AdaptAWSError converts AWS package errors to internal errors
func EnhanceAWSError ¶
EnhanceAWSError enhances AWS error with operation context
func FormatWithContext ¶
func FormatWithContext(err error, ctx ErrorContext) string
FormatWithContext formats an error with additional context
func GetErrorDetails ¶
GetErrorDetails extracts error details
func IsConfigError ¶
IsConfigError checks if the error is a configuration error
func IsNetworkError ¶
IsNetworkError checks if the error is a network error
func IsValidationError ¶
IsValidationError checks if the error is a validation error
func PrintErrorVerbose ¶
func PrintErrorVerbose(err error)
PrintErrorVerbose prints an error with verbose information.
func PrintInfof ¶
func PrintInfof(format string, args ...interface{})
PrintInfo prints an info message.
func PrintSuccessf ¶
func PrintSuccessf(format string, args ...interface{})
PrintSuccess prints a success message.
Types ¶
type EnvyError ¶
type EnvyError struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Details map[string]interface{} `json:"details,omitempty"`
Cause error `json:"-"`
Timestamp time.Time `json:"timestamp"`
Retriable bool `json:"retriable"`
}
EnvyError は envy のカスタムエラー型
func ValidationError ¶
ValidationError はバリデーション関連のエラーを作成
func WrapAWSError ¶
WrapAWSError converts AWS SDK errors to EnvyError
func WrapFileError ¶
WrapFileError converts file operation errors to EnvyError
func WrapNetworkError ¶
WrapNetworkError converts network errors to EnvyError
func (*EnvyError) UserMessage ¶
UserMessage returns user-friendly error messages
func (*EnvyError) WithDetails ¶
WithDetails は詳細情報を追加
func (*EnvyError) WithRetriable ¶
WithRetriable はリトライ可能フラグを設定
type ErrorAggregator ¶
type ErrorAggregator struct {
// contains filtered or unexported fields
}
AggregateErrors combines multiple errors into one
func NewAggregator ¶
func NewAggregator() *ErrorAggregator
NewAggregator creates a new error aggregator
func (*ErrorAggregator) Add ¶
func (a *ErrorAggregator) Add(err error)
Add adds an error to the aggregator
func (*ErrorAggregator) AddWithContext ¶
func (a *ErrorAggregator) AddWithContext(err error, context string)
AddWithContext adds an error with context
func (*ErrorAggregator) Error ¶
func (a *ErrorAggregator) Error() error
Error returns the aggregated error
func (*ErrorAggregator) Errors ¶
func (a *ErrorAggregator) Errors() []error
Errors returns all collected errors
func (*ErrorAggregator) HasErrors ¶
func (a *ErrorAggregator) HasErrors() bool
HasErrors checks if there are any errors
type ErrorCode ¶
type ErrorCode string
ErrorCode represents the type of error
const ( // Configuration related errors ErrConfigNotFound ErrorCode = "CONFIG_NOT_FOUND" ErrConfigInvalid ErrorCode = "CONFIG_INVALID" ErrConfigParse ErrorCode = "CONFIG_PARSE" ErrConfigPermission ErrorCode = "CONFIG_PERMISSION" // Validation related errors ErrValidationFailed ErrorCode = "VALIDATION_FAILED" ErrInvalidArgument ErrorCode = "INVALID_ARGUMENT" ErrInvalidEnvironment ErrorCode = "INVALID_ENVIRONMENT" ErrInvalidKeyFormat ErrorCode = "INVALID_KEY_FORMAT" ErrRequiredField ErrorCode = "REQUIRED_FIELD" // AWS related errors ErrAWSAuth ErrorCode = "AWS_AUTH_FAILED" ErrAWSConnection ErrorCode = "AWS_CONNECTION_FAILED" ErrAWSRateLimit ErrorCode = "AWS_RATE_LIMIT" ErrAWSAccessDenied ErrorCode = "AWS_ACCESS_DENIED" ErrParameterNotFound ErrorCode = "PARAMETER_NOT_FOUND" ErrSecretNotFound ErrorCode = "SECRET_NOT_FOUND" ErrParameterExists ErrorCode = "PARAMETER_EXISTS" ErrSecretExists ErrorCode = "SECRET_EXISTS" ErrAWSTimeout ErrorCode = "AWS_TIMEOUT" // File related errors ErrFileNotFound ErrorCode = "FILE_NOT_FOUND" ErrFilePermission ErrorCode = "FILE_PERMISSION" ErrFileRead ErrorCode = "FILE_READ" ErrFileWrite ErrorCode = "FILE_WRITE" ErrFileInvalid ErrorCode = "FILE_INVALID" // Network related errors ErrNetworkTimeout ErrorCode = "NETWORK_TIMEOUT" ErrDNSResolution ErrorCode = "DNS_RESOLUTION" // System errors ErrInternal ErrorCode = "INTERNAL_ERROR" ErrUnknown ErrorCode = "UNKNOWN_ERROR" ErrNotSupported ErrorCode = "NOT_SUPPORTED" ErrTimeout ErrorCode = "TIMEOUT" ErrInvalidInput ErrorCode = "INVALID_INPUT" )
func GetErrorCode ¶
GetErrorCode extracts the error code from an error
type ErrorContext ¶
type ErrorContext struct {
Operation string
Environment string
Region string
Profile string
File string
}
ErrorContext provides additional context for errors
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter provides error formatting functionality
func NewFormatter ¶
NewFormatter creates a new error formatter
func (*Formatter) FormatMultiple ¶
FormatMultiple formats multiple errors
func (*Formatter) FormatShort ¶
FormatShort formats an error in a compact way