errors

package
v0.0.0-...-bda6563 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIsRequired           = errors.New("is required")
	ErrMustBeValidDate      = errors.New("must be a RFC3339 date")
	ErrMustBePositive       = errors.New("must be positive")
	ErrMustBePositiveOrZero = errors.New("must be positive or zero")
	ErrMustBeNegative       = errors.New("must be negative")
	ErrMustBeNegativeOrZero = errors.New("must be negative or zero")
	ErrIsNotValid           = errors.New("is not a valid value")
	ErrIsNotValidNumber     = errors.New("is not a valid number")
	ErrIsNotSupported       = errors.New("is not supported")
	ErrIsUnauthorised       = errors.New("is unauthorised")
	ErrDoesNotMatch         = errors.New("does not match")
	ErrNotAValidInteger     = errors.New("not a valid integer")
	ErrNotAValidFloat       = errors.New("not a valid float")
)

Functions

func InvalidFormatError

func InvalidFormatError(name string) error

func MustBase64EncodedError

func MustBase64EncodedError(name string) error

func MustBeSpecifiedError

func MustBeSpecifiedError(name string) error

func MustSpecifiedOneOfError

func MustSpecifiedOneOfError(values ...string) error

func MutuallyExclusiveError

func MutuallyExclusiveError(n1, n2 string) error

func RequireBetweenValuesError

func RequireBetweenValuesError(n, leftInclusive, rightExclusive string) error

func RequireGreaterThanError

func RequireGreaterThanError(n, oth string) error

func RequireGreaterThanOrEqualError

func RequireGreaterThanOrEqualError(n, oth string) error

func RequireLessThanError

func RequireLessThanError(n, oth string) error

func RequireLessThanOrEqualError

func RequireLessThanOrEqualError(n, oth string) error

func UnsupportedValueError

func UnsupportedValueError(name string, unsupported interface{}, supported []interface{}) error

Types

type CumulatedErrors

type CumulatedErrors struct {
	Errors []error
}

func NewCumulatedErrors

func NewCumulatedErrors() *CumulatedErrors

func (*CumulatedErrors) Add

func (e *CumulatedErrors) Add(err error)

func (*CumulatedErrors) Error

func (e *CumulatedErrors) Error() string

func (*CumulatedErrors) HasAny

func (e *CumulatedErrors) HasAny() bool

type Errors

type Errors map[string][]error

func NewErrors

func NewErrors() Errors

func (Errors) Add

func (e Errors) Add(err error)

Add adds a general error that is not related to a specific property.

func (Errors) AddForProperty

func (e Errors) AddForProperty(prop string, err error)

AddForProperty adds an error for a given property.

func (Errors) Empty

func (e Errors) Empty() bool

func (Errors) Error

func (e Errors) Error() string

func (Errors) ErrorOrNil

func (e Errors) ErrorOrNil() error

func (Errors) FinalAdd

func (e Errors) FinalAdd(err error) Errors

FinalAdd behaves like Add, but is meant to be called in a "return" statement. This helper is usually used for terminal errors.

func (Errors) FinalAddForProperty

func (e Errors) FinalAddForProperty(prop string, err error) Errors

FinalAddForProperty behaves like AddForProperty, but is meant to be called in a "return" statement. This helper is usually used for terminal errors.

func (Errors) Get

func (e Errors) Get(prop string) []error

func (Errors) MarshalJSON

func (e Errors) MarshalJSON() ([]byte, error)

func (Errors) Merge

func (e Errors) Merge(oth Errors)

Jump to

Keyboard shortcuts

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