errors

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As added in v1.16.0

func As[E error](err error) (e E, _ bool)

As is a utility for one-lining errors.As statements. e.g. cerr, match := errors.As[MyCustomError](err).

func EmptyFieldError

func EmptyFieldError(field string) error

EmptyFieldError creates an ErrInvalidField for an empty field

func ErrInvalidf

func ErrInvalidf(format string, args ...interface{}) error

ErrInvalidf creates an ErrInvalid using a custom format

func ErrNotFoundf

func ErrNotFoundf(format string, args ...interface{}) error

ErrNotFoundf creates an ErrNotFound using a custom format

func InvalidFieldError

func InvalidFieldError(field, reason string) error

InvalidFieldError creates an ErrInvalidField for a specific field and reason

func New

func New(s string) error

New creates a new error with errors.New

Types

type ErrInvalid

type ErrInvalid string

ErrInvalid represents an invalid error

func (ErrInvalid) Error

func (e ErrInvalid) Error() string

type ErrNotFound

type ErrNotFound string

ErrNotFound represents a not found error

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type ErrValidation

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

ErrValidation is a validation error for a specific field and reason

func (ErrValidation) Error

func (e ErrValidation) Error() string

Jump to

Keyboard shortcuts

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