errors

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReleaseFieldError

func ReleaseFieldError(fe *FieldError)

func ReleaseFieldErrors

func ReleaseFieldErrors(fe FieldErrors)

Types

type ErrorObject

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

func NewErrorObject

func NewErrorObject(code string, message string) ErrorObject

NewErrorObject ...

func (ErrorObject) Error

func (e ErrorObject) Error() string

func (ErrorObject) GetCode

func (e ErrorObject) GetCode() string

func (ErrorObject) GetErrorTemplate

func (e ErrorObject) GetErrorTemplate() *template.Template

func (ErrorObject) MarshalJSON

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

func (ErrorObject) SetErrorTemplate

func (e ErrorObject) SetErrorTemplate(newTemplate *template.Template) error

func (ErrorObject) SetParams

func (e ErrorObject) SetParams(params any) ErrorObject

type ErrorObjectFactory

type ErrorObjectFactory interface {
	NewErrorObject(code string) ErrorObject
}

func DefaultErrorObjectFactory

func DefaultErrorObjectFactory() ErrorObjectFactory

DefaultErrorObjectFactory ...

func NewErrorObjectFactory

func NewErrorObjectFactory(registry translationRegistry) ErrorObjectFactory

type ErrorSlice

type ErrorSlice []error

func (ErrorSlice) AppendError

func (es ErrorSlice) AppendError(err error) ErrorSlice

func (ErrorSlice) Error

func (es ErrorSlice) Error() string

func (ErrorSlice) MarshalJSON

func (es ErrorSlice) MarshalJSON() ([]byte, error)

type Errors

type Errors map[string]error

func FieldErrorToErrors

func FieldErrorToErrors(fs FieldErrors) Errors

func (Errors) Error

func (es Errors) Error() string

func (Errors) Is

func (es Errors) Is(err error) bool

func (Errors) Join

func (es Errors) Join(errs Errors) Errors

func (Errors) MarshalJSON

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

MarshalJSON converts the Errors into a valid JSON.

type Field

type Field interface {
	GetName() string
	SetNameKey(key string)
}

func NewStringField

func NewStringField(field string) Field

type FieldError

type FieldError struct {
	Field string
	// contains filtered or unexported fields
}

func NewFieldError

func NewFieldError(fieldName string, err error) *FieldError

func (*FieldError) Error

func (f *FieldError) Error() string

type FieldErrors

type FieldErrors []*FieldError

func NewFieldErrors

func NewFieldErrors(opts ...NewFieldErrorsOpt) FieldErrors

func (FieldErrors) Error

func (fes FieldErrors) Error() string

type NewFieldErrorsOpt

type NewFieldErrorsOpt func(opt *newFieldErrorsOpt)

func WithStartCap

func WithStartCap(startCap int) NewFieldErrorsOpt

Directories

Path Synopsis
map
Package errorspresenter provides types to present validation errors in any formats.
Package errorspresenter provides types to present validation errors in any formats.

Jump to

Keyboard shortcuts

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