errors

package
v0.0.0-...-2bab971 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

func DisableSourcing

func DisableSourcing()

func EnableSourcing

func EnableSourcing()

func Is

func Is(err error, target error) bool

func Join

func Join(errs ...error) error

func New

func New(message string, attrs ...Attribute) error

func SourcingEnabled

func SourcingEnabled() bool

func Wrap

func Wrap(target error, attrs ...Attribute) error

Types

type Attribute

type Attribute struct {
	Key   string
	Value string
}

func Attr

func Attr(key string, value string) Attribute

type Error

type Error struct {
	Message string      `json:"message"`
	Source  Source      `json:"source"`
	Attrs   []Attribute `json:"attrs"`
	Wrapped []*Error    `json:"wrapped"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Format

func (e *Error) Format(state fmt.State, verb rune)

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() []error

func (*Error) WriteTo

func (e *Error) WriteTo(w io.Writer) (n int64, err error)

type Source

type Source struct {
	Function string `json:"function"`
	File     string `json:"file"`
	Line     int    `json:"line"`
}

Jump to

Keyboard shortcuts

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