Documentation
¶
Index ¶
- func As[T any](err error) (T, bool)
- func Assertf(cond bool, format string, a ...any)
- func Errorf(format string, a ...any) error
- func IgnoreClose(c io.Closer)
- func MaybeMustWrap(err error, outerErrs ...error)
- func MaybeWrap(err error, outerErrs ...error) error
- func MaybeWrapRecover(r any, outerErrs ...error) error
- func MustClose(c io.Closer)
- func MustErrorf(format string, a ...any)
- func MustWrap(innerErr error, outerErrs ...error)
- func SDump(err error) string
- func Wrap(err error, outerErrs ...error) error
- func WrapRecover(r any, outerErrs ...error) error
- type AsHelper
- type Frame
- type Frames
- type IsHelper
- type UnwrapMulti
- type UnwrapSingle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreClose ¶
IgnoreClose calls Close on the given io.Closer, ignoring the returned error. Handy for the defer Close pattern.
func MaybeMustWrap ¶
MaybeMustWrap is like MustWrap, but does nothing if called with a nil error.
func MaybeWrapRecover ¶
MaybeWrapRecover is like WrapRecover but returns nil if called with a nil value.
func MustClose ¶
MustClose calls Close on the given io.Closer, panicking in case of error. Handy for the defer Close pattern.
func MustErrorf ¶
MustErrorf is like Errorf but panics with the wrapped error instead of returning it.
func WrapRecover ¶
WrapRecover takes a recovered value and converts it to a wrapped error.
Types ¶
type Frame ¶
type Frame struct { Summary string `json:"summary,omitempty"` Location string `json:"location,omitempty"` ShortLocation string `json:"shortLocation,omitempty"` Package string `json:"fullPackage,omitempty"` ShortPackage string `json:"package,omitempty"` Function string `json:"function,omitempty"` FileAndLine string `json:"fileAndLine,omitempty"` File string `json:"file,omitempty"` Line int `json:"line,omitempty"` }
Frame describes a frame.
type Frames ¶
type Frames []*Frame
Frames describes a stack of frames.
func GetFrames ¶
GetFrames returns the frames from the error, or the current frames the error is not wrapped or is nil.
func (Frames) ToSummaries ¶
ToSummaries converts the frames to a slice of frame summaries.
type UnwrapMulti ¶
type UnwrapMulti interface {
Unwrap() []error
}
UnwrapMulti describes a method which returns multiple errors.
type UnwrapSingle ¶
type UnwrapSingle interface {
Unwrap() error
}
UnwrapSingle describes a method which returns a single error.