apperrors

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

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

func WrapExtension(name, op string, err error) error

WrapExtension wraps an error as an extension error.

func WrapFile

func WrapFile(op, path string, err error) error

WrapFile wraps an error as a file operation error.

func WrapGit

func WrapGit(operation string, err error) error

WrapGit wraps an error as a git operation error.

Types

type CommandError

type CommandError struct {
	Command string
	Err     error
	Timeout bool
}

CommandError indicates a command execution error.

func (*CommandError) Error

func (e *CommandError) Error() string

func (*CommandError) Unwrap

func (e *CommandError) Unwrap() error

type ConfigError

type ConfigError struct {
	Operation string
	Err       error
}

ConfigError indicates a configuration-related error.

func (*ConfigError) Error

func (e *ConfigError) Error() string

func (*ConfigError) Unwrap

func (e *ConfigError) Unwrap() error

type ExtensionError

type ExtensionError struct {
	Name string
	Op   string
	Err  error
}

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 FileError

type FileError struct {
	Op   string
	Path string
	Err  error
}

FileError indicates a file operation error with path context.

func (*FileError) Error

func (e *FileError) Error() string

func (*FileError) Unwrap

func (e *FileError) Unwrap() error

type GitError

type GitError struct {
	Operation string
	Err       error
}

GitError indicates a git operation error with command context.

func (*GitError) Error

func (e *GitError) Error() string

func (*GitError) Is

func (e *GitError) Is(target error) bool

Is allows errors.Is to match against ErrGitOperation.

func (*GitError) Unwrap

func (e *GitError) Unwrap() error

type HookError

type HookError struct {
	HookName string
	Err      error
}

HookError indicates an error during hook execution.

func (*HookError) Error

func (e *HookError) Error() string

func (*HookError) Unwrap

func (e *HookError) Unwrap() error

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

type InvalidVersionError struct {
	Version string
	Reason  string
}

InvalidVersionError indicates that a version string does not conform to semver.

func (*InvalidVersionError) Error

func (e *InvalidVersionError) Error() string

type PathValidationError

type PathValidationError struct {
	Path   string
	Reason string
}

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

Jump to

Keyboard shortcuts

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