Documentation
¶
Index ¶
- Variables
- type ErrorType
- type KairoError
- func ConfigFileError(message, configPath string, hint string, cause error) *KairoError
- func CryptoErrorWithHint(message, hint string, cause error) *KairoError
- func FileError(message, path string, cause error) *KairoError
- func NewError(errorType ErrorType, message string) *KairoError
- func ProviderErr(message, providerName string, cause error) *KairoError
- func RuntimeErr(message string, cause error) *KairoError
- func WrapError(errorType ErrorType, message string, cause error) *KairoError
Constants ¶
This section is empty.
Variables ¶
var ErrConfigNotFound = errors.New("configuration file not found")
ErrConfigNotFound is returned when the configuration file does not exist.
Functions ¶
This section is empty.
Types ¶
type ErrorType ¶
type ErrorType string
ErrorType represents different categories of errors.
const ( // ConfigError indicates configuration-related errors ConfigError ErrorType = "config" // CryptoError indicates encryption/decryption errors CryptoError ErrorType = "crypto" // ValidationError indicates input validation errors ValidationError ErrorType = "validation" // ProviderError indicates provider-related errors ProviderError ErrorType = "provider" // FileSystemError indicates file system errors FileSystemError ErrorType = "filesystem" // NetworkError indicates network-related errors NetworkError ErrorType = "network" // RuntimeError indicates runtime/panic errors RuntimeError ErrorType = "runtime" )
type KairoError ¶
KairoError is a structured error type that provides context about what went wrong.
func ConfigFileError ¶
func ConfigFileError(message, configPath string, hint string, cause error) *KairoError
ConfigFileError creates a formatted configuration file error with path and hints.
func CryptoErrorWithHint ¶
func CryptoErrorWithHint(message, hint string, cause error) *KairoError
CryptoErrorWithHint creates a formatted crypto error with operation hints.
func FileError ¶
func FileError(message, path string, cause error) *KairoError
FileError creates a formatted filesystem error with file path context.
func NewError ¶
func NewError(errorType ErrorType, message string) *KairoError
NewError creates a new KairoError with the given type and message.
func ProviderErr ¶
func ProviderErr(message, providerName string, cause error) *KairoError
ProviderErr creates a formatted provider error with provider name.
func RuntimeErr ¶ added in v1.5.0
func RuntimeErr(message string, cause error) *KairoError
RuntimeErr creates a formatted runtime/panic error. Uses "Err" suffix to avoid conflict with RuntimeError type constant (similar to ProviderErr).
func WrapError ¶
func WrapError(errorType ErrorType, message string, cause error) *KairoError
WrapError creates a new KairoError that wraps an existing error.
func (*KairoError) Error ¶
func (e *KairoError) Error() string
Error implements the error interface.
func (*KairoError) Is ¶
func (e *KairoError) Is(target error) bool
Is returns true if the target error is of the same type.
func (*KairoError) Unwrap ¶
func (e *KairoError) Unwrap() error
Unwrap returns the underlying cause for use with errors.Is/As.
func (*KairoError) WithContext ¶
func (e *KairoError) WithContext(key, value string) *KairoError
WithContext adds context to an existing KairoError.