errors

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound         = errors.New("resource not found")
	ErrInvalidArgument  = errors.New("invalid argument")
	ErrInvalidOperation = errors.New("invalid operation")
	ErrUnauthorized     = errors.New("unauthorized")
	ErrInternal         = errors.New("internal error")
)

Common errors that can be used across packages

Functions

func As

func As(err error, target interface{}) bool

As finds the first error in err's chain that matches target. It enables errors.As() to work with our custom error types.

func Is

func Is(err, target error) bool

Is reports whether target matches err. It enables errors.Is() to work with our custom error types.

func NewFileError

func NewFileError(path, op string, wrapped error) error

NewFileError creates a new FileError

func NewPackageError

func NewPackageError(op, pkg, version string, wrapped error) error

NewPackageError creates a new PackageError

func NewVCSError

func NewVCSError(op, path string, wrapped error) error

NewVCSError creates a new VCSError

func NewValidationError

func NewValidationError(field, message string) error

NewValidationError creates a new ValidationError

func Wrap

func Wrap(err error, message string) error

Wrap wraps an error with additional context

Types

type FileError

type FileError struct {
	Path    string
	Op      string
	Wrapped error
}

FileError represents an error that occurs during file operations

func (*FileError) Error

func (e *FileError) Error() string

func (*FileError) Unwrap

func (e *FileError) Unwrap() error

type PackageError

type PackageError struct {
	Op      string
	Package string
	Version string
	Wrapped error
}

PackageError represents an error that occurs during package operations

func (*PackageError) Error

func (e *PackageError) Error() string

func (*PackageError) Unwrap

func (e *PackageError) Unwrap() error

type VCSError

type VCSError struct {
	Op      string
	Path    string
	Wrapped error
}

VCSError represents an error that occurs during version control operations

func (*VCSError) Error

func (e *VCSError) Error() string

func (*VCSError) Unwrap

func (e *VCSError) Unwrap() error

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents an error that occurs during validation

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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