preseterrors

package
v0.0.0-...-b784633 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout          = errors.New("timeout")
	ErrInvalidArguments = errors.New("invalid arguments")
	ErrNotFound         = errors.New("not found")
	ErrUnauthorized     = errors.New("unauthorized")
	ErrForbidden        = errors.New("forbidden")
	ErrInternalProblem  = errors.New("internal problem")
)

Functions

func IsValidationError

func IsValidationError(err error) bool

Types

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Marshalable

type Marshalable interface {
	MarshalAs() (map[string]any, error)
}

type Matcher

type Matcher func(error) bool

func ErrIs

func ErrIs(target error) Matcher

type ValidationError

type ValidationError struct {
	Message     string        `json:"message"`
	FieldErrors []*FieldError `json:"fieldErrors"`
}

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) MarshalAs

func (e ValidationError) MarshalAs() (map[string]any, error)

Jump to

Keyboard shortcuts

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