errors

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package errors provides standardized domain errors for business logic.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound indicates the requested resource does not exist.
	ErrNotFound = errors.New("not found")

	// ErrConflict indicates a conflict with existing data.
	ErrConflict = errors.New("conflict")

	// ErrInvalidInput indicates the input data is invalid or fails validation.
	ErrInvalidInput = errors.New("invalid input")

	// ErrUnauthorized indicates missing or invalid authentication credentials.
	ErrUnauthorized = errors.New("unauthorized")

	// ErrForbidden indicates insufficient permissions.
	ErrForbidden = errors.New("forbidden")
)

Standard domain errors that can be used across all domain modules.

Functions

func As

func As(err error, target any) bool

As finds the first error in err's tree that matches target.

func Is

func Is(err, target error) bool

Is reports whether any error in err's tree matches target.

func New

func New(message string) error

New creates a new error with the given message.

func Wrap

func Wrap(err error, message string) error

Wrap wraps an error with additional context while preserving the error chain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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