errors

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package errors provides simple error handling for CCMD.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrAlreadyExists = errors.New("already exists")
	ErrInvalidInput  = errors.New("invalid input")
	ErrGitOperation  = errors.New("git operation failed")
	ErrFileOperation = errors.New("file operation failed")
)

Sentinel errors for common error types

View Source
var DefaultHandler = &Handler{
	logger: logger.GetDefault(),
}

DefaultHandler is the default error handler instance

Functions

func AlreadyExists added in v1.1.0

func AlreadyExists(resource string) error

AlreadyExists creates an already exists error with context

func FileError added in v1.1.0

func FileError(operation, path string, err error) error

FileError creates a file operation error with context

func GitError added in v1.1.0

func GitError(operation string, err error) error

GitError creates a git operation error with context

func Handle

func Handle(err error) bool

Handle is a convenience function using the default handler

func HandleFatal

func HandleFatal(err error)

HandleFatal is a convenience function using the default handler

func InvalidInput added in v1.1.0

func InvalidInput(msg string) error

InvalidInput creates an invalid input error with context

func NotFound added in v1.1.0

func NotFound(resource string) error

NotFound creates a not found error with context

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler provides centralized error handling with logging

func (*Handler) Handle

func (h *Handler) Handle(err error) bool

Handle processes an error and returns true if it was handled

func (*Handler) HandleFatal

func (h *Handler) HandleFatal(err error)

HandleFatal processes a fatal error and exits

Jump to

Keyboard shortcuts

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