Documentation ¶
Overview ¶
Package merr extends the errors package with features like key-value attributes for errors, embedded stacktraces, and multi-errors.
merr functions takes in generic errors of the built-in type. The returned errors are wrapped by a type internal to merr, and appear to also be of the generic error type.
As is generally recommended for go projects, errors.Is and errors.As should be used for equality checking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MaxStackSize = 50
MaxStackSize indicates the maximum number of stack frames which will be stored when embedding stack traces in errors.
Functions ¶
Types ¶
type Error ¶
type Error struct { Err error Ctx context.Context Stacktrace Stacktrace }
Error wraps an error such that contextual and stacktrace information is captured alongside that error.
type Stacktrace ¶
type Stacktrace struct {
// contains filtered or unexported fields
}
Stacktrace represents a stack trace at a particular point in execution.
func (Stacktrace) Frame ¶
func (s Stacktrace) Frame() runtime.Frame
Frame returns the first frame in the stack.
func (Stacktrace) Frames ¶
func (s Stacktrace) Frames() []runtime.Frame
Frames returns all runtime.Frame instances for this stack.
func (Stacktrace) FullString ¶
func (s Stacktrace) FullString() string
FullString returns the full stack trace.
func (Stacktrace) String ¶
func (s Stacktrace) String() string
String returns a string representing the top-most frame of the stack.