Documentation ¶
Index ¶
- func Append(err error, errs ...error) error
- func ForceMarshalError(e error) []byte
- func Join(errs ...error) error
- func MarshalError(aerr error) ([]byte, error)
- func NewEquivalent(msg string, errs ...error) error
- func WithEquivalents(err error, errs ...error) error
- func WithStack(err error, fields ...any) error
- type Error
- func (e *Error) As(target any) bool
- func (e *Error) Error() string
- func (e *Error) Is(target error) bool
- func (e *Error) MarshalJSON() ([]byte, error)
- func (e *Error) Unwrap() error
- func (e *Error) WithEquivalents(errs ...error) *Error
- func (e *Error) WithField(key string, value any) *Error
- func (e *Error) WithFields(fields ...any) *Error
- type Fields
- type HumanError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append appends one or more errors additionally to the first error. It will return nil if err is nil. It will unwrap err if it implements `interface { Unwrap() []error }` and merge the value with errs. It will merge the errors from the previous Append call in a single slice.
func ForceMarshalError ¶
func Join ¶
Join merges one or more errors under the hood of a single error. nil values are discarded. It will return nil if all errors are nil or no errors were given.
func MarshalError ¶
func NewEquivalent ¶
func WithEquivalents ¶
WithEquivalents creates a new error with equivalent errors. It wraps the given error and appends the provided equivalent errors.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func WithFields ¶
func (*Error) MarshalJSON ¶
func (*Error) WithEquivalents ¶
func (*Error) WithFields ¶
type HumanError ¶
type HumanError struct {
// contains filtered or unexported fields
}
func NewHumanError ¶
func NewHumanError(msg string, details error) *HumanError
func (*HumanError) Error ¶
func (e *HumanError) Error() string
func (*HumanError) MarshalJSON ¶
func (e *HumanError) MarshalJSON() ([]byte, error)
func (*HumanError) Unwrap ¶
func (e *HumanError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.