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.
var ErrEmptyCLIPath = errors.New("cli path cannot be empty")
ErrEmptyCLIPath is returned when a CLI path is empty.
var ErrEmptyToken = errors.New("token cannot be empty")
ErrEmptyToken is returned when a token is empty.
var ErrEmptyTokenPath = errors.New("token path cannot be empty")
ErrEmptyTokenPath is returned when a token path is empty.
var ErrEnvVarCollision = errors.New("environment variable collision detected")
ErrEnvVarCollision is returned when multiple providers set the same environment variable with different values.
var ErrInvalidPathInBackup = errors.New("invalid path in backup (may be path traversal attempt)")
ErrInvalidPathInBackup is returned when a backup contains an invalid path (path traversal attempt).
var ErrProviderModelInvalidChars = errors.New("provider model name contains invalid characters")
ErrProviderModelInvalidChars is returned when a provider model name contains invalid characters.
var ErrProviderModelTooLong = errors.New("provider model name is too long")
ErrProviderModelTooLong is returned when a provider model name exceeds the maximum length.
var ErrRecoveryPhraseInvalid = errors.New("recovery phrase is invalid or contains typos")
ErrRecoveryPhraseInvalid is returned when a recovery phrase is invalid or contains typos.
var ErrRecoveryPhraseTooLong = errors.New("recovery phrase exceeds maximum length")
ErrRecoveryPhraseTooLong is returned when a recovery phrase exceeds maximum length.
var ErrRecoveryPhraseTooShort = errors.New("recovery phrase too short")
ErrRecoveryPhraseTooShort is returned when a recovery phrase is too short.
var ErrUnsupportedFormat = errors.New("unsupported export format")
ErrUnsupportedFormat is returned when an unsupported export format is used.
var ErrUserCancelled = errors.New("user cancelled input")
ErrUserCancelled is returned when the user cancels input (Ctrl+C or Ctrl+D).
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.