errors

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNotFound = errors.New("configuration file not found")

ErrConfigNotFound is returned when the configuration file does not exist.

View Source
var ErrEmptyCLIPath = errors.New("cli path cannot be empty")

ErrEmptyCLIPath is returned when a CLI path is empty.

View Source
var ErrEmptyToken = errors.New("token cannot be empty")

ErrEmptyToken is returned when a token is empty.

View Source
var ErrEmptyTokenPath = errors.New("token path cannot be empty")

ErrEmptyTokenPath is returned when a token path is empty.

View Source
var ErrEnvVarCollision = errors.New("environment variable collision detected")

ErrEnvVarCollision is returned when multiple providers set the same environment variable with different values.

View Source
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).

View Source
var ErrProviderModelInvalidChars = errors.New("provider model name contains invalid characters")

ErrProviderModelInvalidChars is returned when a provider model name contains invalid characters.

View Source
var ErrProviderModelTooLong = errors.New("provider model name is too long")

ErrProviderModelTooLong is returned when a provider model name exceeds the maximum length.

View Source
var ErrRecoveryPhraseInvalid = errors.New("recovery phrase is invalid or contains typos")

ErrRecoveryPhraseInvalid is returned when a recovery phrase is invalid or contains typos.

View Source
var ErrRecoveryPhraseTooLong = errors.New("recovery phrase exceeds maximum length")

ErrRecoveryPhraseTooLong is returned when a recovery phrase exceeds maximum length.

View Source
var ErrRecoveryPhraseTooShort = errors.New("recovery phrase too short")

ErrRecoveryPhraseTooShort is returned when a recovery phrase is too short.

View Source
var ErrUnsupportedFormat = errors.New("unsupported export format")

ErrUnsupportedFormat is returned when an unsupported export format is used.

View Source
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

type KairoError struct {
	Type    ErrorType
	Message string
	Cause   error
	Context map[string]string
}

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.

Jump to

Keyboard shortcuts

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