errs

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(fmtOrErr any, default_ any, args ...any) error

func Errors

func Errors[T comparable](m []ValidationError[T]) []error

func Wrap

func Wrap(err error, message string) error

func WrapErrors

func WrapErrors(errs ...error) error

Types

type DjangoError

type DjangoError interface {
	error
	Is(error) bool
	DjangoError() // marker method
}

type Error

type Error string
const (
	// Generic errors
	ErrFieldRequired Error = "Required field cannot be empty"
	ErrInvalidSyntax Error = "Invalid syntax for value"
	ErrInvalidType   Error = "Invalid type provided"
	ErrInvalidValue  Error = "Invalid value provided"
	ErrLengthMin     Error = "Minimum length not met"
	ErrLengthMax     Error = "Maximum length exceeded"
	ErrUnknown       Error = "Unknown error occurred"
)

func (Error) Error

func (e Error) Error() string

func (Error) Is

func (e Error) Is(other error) bool

type MultiError

type MultiError struct {
	Errors []error
}

func NewMultiError

func NewMultiError(errs ...error) *MultiError

func (*MultiError) Append

func (m *MultiError) Append(err error)

func (*MultiError) As

func (m *MultiError) As(target interface{}) bool

func (*MultiError) Error

func (m *MultiError) Error() string

func (*MultiError) Is

func (m *MultiError) Is(target error) bool

func (*MultiError) Len

func (m *MultiError) Len() int

func (*MultiError) MarshalJSON

func (m *MultiError) MarshalJSON() ([]byte, error)

func (*MultiError) Unwrap

func (m *MultiError) Unwrap() []error

type ValidationError

type ValidationError[T comparable] struct {
	Name T
	Err  error
}

func NewValidationError

func NewValidationError[T comparable](name T, err any) ValidationError[T]

func (ValidationError[T]) DjangoError

func (e ValidationError[T]) DjangoError()

func (ValidationError[T]) Error

func (e ValidationError[T]) Error() string

func (ValidationError[T]) Is

func (e ValidationError[T]) Is(other error) bool

func (ValidationError[T]) MarshalJSON

func (e ValidationError[T]) MarshalJSON() ([]byte, error)

type WithMessage

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

func (*WithMessage) Error

func (w *WithMessage) Error() string

func (*WithMessage) Is

func (w *WithMessage) Is(other error) bool

func (*WithMessage) Unwrap

func (w *WithMessage) Unwrap() error

Jump to

Keyboard shortcuts

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