Documentation
¶
Index ¶
- Variables
- type Bundle
- func (b *Bundle) Add(kind Kind, code Code, message string, tags ...string) *Error
- func (b *Bundle) AddKinds(kinds ...Kind) error
- func (b *Bundle) Get(code Code) *Error
- func (b *Bundle) Iter(fn func(code Code, err *Error) error) error
- func (b *Bundle) Len() int
- func (b *Bundle) Load(errorBytes []byte, unmarshal unmarshalFn) error
- func (b *Bundle) LoadFS(fs embed.FS, unmarshal unmarshalFn) error
- func (b *Bundle) MustAddKinds(kinds ...Kind) bool
- func (b *Bundle) MustLoad(errorBytes []byte, unmarshal unmarshalFn) bool
- func (b *Bundle) MustLoadFS(fs embed.FS, unmarshal unmarshalFn) bool
- type Code
- type Error
- func (e *Error) Copy() *Error
- func (e Error) Error() string
- func (e *Error) Is(target error) bool
- func (e *Error) MarshalJSON() ([]byte, error)
- func (e Error) String() string
- func (e *Error) Unwrap() error
- func (e *Error) WithParams(params any) *Error
- func (e *Error) WithTag(tags ...string) *Error
- func (e *Error) Wrap(cause error) *Error
- type Kind
- type PartialError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidKind = errors.New("errors: kind is invalid") ErrCodeNotFound = errors.New("errors: error code not found") ErrDuplicateCode = errors.New("errors: duplicate error code") )
Errors
View Source
var ( Get = bundle.Get Add = bundle.Add AddKinds = bundle.AddKinds MustAddKinds = bundle.MustAddKinds Len = bundle.Len Load = bundle.Load Iter = bundle.Iter MustLoad = bundle.MustLoad LoadFS = bundle.LoadFS MustLoadFS = bundle.MustLoadFS )
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
func (*Bundle) MustAddKinds ¶ added in v0.12.1
type Error ¶
Error represents an error.
func (*Error) MarshalJSON ¶ added in v0.13.1
func (*Error) WithParams ¶ added in v0.6.0
type PartialError ¶
type PartialError[T any] struct { // contains filtered or unexported fields }
func ToPartial ¶ added in v0.8.0
func ToPartial[T any](err *Error) *PartialError[T]
func (*PartialError[T]) Unwrap ¶ added in v0.8.0
func (p *PartialError[T]) Unwrap() *Error
func (*PartialError[T]) WithParams ¶ added in v0.8.0
func (p *PartialError[T]) WithParams(t T) *Error
func (*PartialError[T]) WithTag ¶ added in v0.8.0
func (p *PartialError[T]) WithTag(tags ...string) *PartialError[T]
Click to show internal directories.
Click to hide internal directories.