Documentation
¶
Index ¶
- Variables
- func New(t Tags) error
- func NewFrameError(f Frame, t Tags, err error, wrap bool) error
- func With(err error) error
- func WithStack(err error) error
- func Witht(err error, t Tags) error
- func Wrap(err error, allowed ...error) error
- func Wrapt(err error, t Tags, allowed ...error) error
- type Baser
- type Frame
- type Stack
- type StackFrame
- type Tags
Constants ¶
This section is empty.
Variables ¶
var ImportPrefix string
ImportPrefix strips off pkgs when formatting, to shorten. Only set in a pkg init().
Functions ¶
func NewFrameError ¶
NewFrameError enriches err with stack information from f and tags t. If wrap is true, the returned error will implement Unwrap returning err.
func With ¶
With enriches err with stack information from the caller of With. The returned error will not implement Unwrap (used by errors.Is/As).
func WithStack ¶
WithStack returns a new error with complete stack information from the caller of WithStack.
This is useful in cases where errors aren't or can't be created and passed around, such as when recovering from panics.
func Wrap ¶
Wrap enriches err with stack information from the caller of Wrap. The returned error will implement Unwrap (used by errors.Is/As) returning err if allowed is empty, or if an item in allowed matches err using errors.Is.
Generally, Wrap should only be used when the returned error is expected to be used with errors.Is or similar. Non-sentinel errors can implement errors.Is to be used with allowed.
Types ¶
type Baser ¶
type Baser interface {
Base() error
}
Custom error types should implement to maintain stacks. Only one of Baser or errors.Unwrap is needed, preferring Baser.
type Stack ¶
type Stack []StackFrame
func BuildStack ¶
Always returns at least 1 StackFrame for a non-nil err. Do not call within error.Error().
type StackFrame ¶
func (StackFrame) String ¶
func (f StackFrame) String() string