Documentation
¶
Overview ¶
Package apperrors defines custom error types for the sley application. These typed errors enable proper error handling with errors.Is and errors.As without coupling internal packages to the CLI framework.
Error Handling Conventions:
- Always wrap errors from external packages with context
- Use sentinel errors for common, well-known conditions
- Use typed errors when callers need to extract structured information
- Include relevant context (file paths, values) in error messages
Index ¶
- Variables
- func WrapExtension(name, op string, err error) error
- func WrapFile(op, path string, err error) error
- func WrapGit(operation string, err error) error
- type CommandError
- type ConfigError
- type ExtensionError
- type FileError
- type GitError
- type HookError
- type InvalidBumpTypeError
- type InvalidVersionError
- type PathValidationError
- type VersionFileNotFoundError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound indicates a resource was not found. ErrNotFound = errors.New("not found") // ErrInvalidInput indicates invalid user input. ErrInvalidInput = errors.New("invalid input") // ErrPermissionDenied indicates insufficient permissions. ErrPermissionDenied = errors.New("permission denied") // ErrAlreadyExists indicates a resource already exists. ErrAlreadyExists = errors.New("already exists") // ErrTimeout indicates an operation timed out. ErrTimeout = errors.New("operation timed out") // ErrCanceled indicates an operation was canceled. ErrCanceled = errors.New("operation canceled") // ErrGitOperation indicates a git operation failed. ErrGitOperation = errors.New("git operation failed") // ErrExtension indicates an extension-related error. ErrExtension = errors.New("extension error") )
Sentinel errors for common conditions. Use errors.Is() to check for these conditions.
Functions ¶
func WrapExtension ¶
WrapExtension wraps an error as an extension error.
Types ¶
type CommandError ¶
CommandError indicates a command execution error.
func (*CommandError) Error ¶
func (e *CommandError) Error() string
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
type ConfigError ¶
ConfigError indicates a configuration-related error.
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
func (*ConfigError) Unwrap ¶
func (e *ConfigError) Unwrap() error
type ExtensionError ¶
ExtensionError indicates an extension-related error.
func (*ExtensionError) Error ¶
func (e *ExtensionError) Error() string
func (*ExtensionError) Is ¶
func (e *ExtensionError) Is(target error) bool
Is allows errors.Is to match against ErrExtension.
func (*ExtensionError) Unwrap ¶
func (e *ExtensionError) Unwrap() error
type GitError ¶
GitError indicates a git operation error with command context.
type InvalidBumpTypeError ¶
type InvalidBumpTypeError struct {
BumpType string
}
InvalidBumpTypeError indicates an invalid bump type was specified.
func (*InvalidBumpTypeError) Error ¶
func (e *InvalidBumpTypeError) Error() string
type InvalidVersionError ¶
InvalidVersionError indicates that a version string does not conform to semver.
func (*InvalidVersionError) Error ¶
func (e *InvalidVersionError) Error() string
type PathValidationError ¶
PathValidationError indicates an invalid or dangerous path was provided.
func (*PathValidationError) Error ¶
func (e *PathValidationError) Error() string
type VersionFileNotFoundError ¶
type VersionFileNotFoundError struct {
Path string
}
VersionFileNotFoundError indicates that the version file does not exist.
func (*VersionFileNotFoundError) Error ¶
func (e *VersionFileNotFoundError) Error() string