Documentation ¶
Overview ¶
Package errors is a custom library to annotate errors.
Based on https://godoc.org/github.com/samsarahq/go/oops and adapted to our function names and needs.
Index ¶
- func As(err error, target any) bool
- func Details(err error) string
- func Errorf(format string, a ...interface{}) error
- func Is(err, target error) bool
- func Join(errs ...error) error
- func LogValue(err error) slog.Value
- func New(text string) error
- func Recover(p interface{}) error
- func Stack(err error) string
- func Trace(err error) error
- func Unwrap(err error) error
- type Frame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errorf ¶
Errorf creates a new error with a formatted message.
Use Errorf in places where you would otherwise return an error using fmt.Errorf.
Note that the result of Errorf includes a stacktrace. This means that Errorf is not suitable for storing in global variables. For such errors, keep using errors.New.
func LogValue ¶ added in v1.3.0
LogValue returns the standard log value to emit the error in a structured way.
func Recover ¶
func Recover(p interface{}) error
Recover recovers from a panic in a defer. If there is no panic, Recover() returns nil. To use, call error.Recover(recover()) and compare the result to nil.