Documentation
¶
Overview ¶
Package stackerr - Go package for errors with stack trace
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPackageName string
DefaultPackageName is the default (short) package name to be used to check which packages are to be captured for the errors stack info
var MaxStackDepth uint = 16
MaxStackDepth is the maximum stack depth to capture
Functions ¶
func SetDefaultPackageFilter ¶
func SetDefaultPackageFilter(pkg string)
SetDefaultPackageFilter sets the DefaultPackageFilter with a filter for the specified package
Types ¶
type FrameFormatter ¶
var DefaultFrameFormatter FrameFormatter = &frameFormatter{}
DefaultFrameFormatter is the formatter used to format call stack frames when formatting StackError
If this is set to nil, no stack info is output when formatting StackError
type PackageFilter ¶
PackageFilter is the interface used by DefaultPackageFilter
var DefaultPackageFilter PackageFilter
DefaultPackageFilter is the default package filter used to determine which packages are to be captured for the errors stack info
type StackError ¶
type StackError interface { error // WithCause returns a StackError with the cause set WithCause(cause error) StackError Unwrap() error Cause() error // StackInfo returns the call stack info for the error StackInfo() StackInfo }
StackError is an error interface with stack info
func Newf ¶
func Newf(format string, args ...any) StackError
Newf creates a new StackError with stack info and a formatted message
func Wrap ¶
func Wrap(err error, msg string) StackError
Wrap wraps an existing error with a StackError
Note: the stack info is based on the point at which Wrap is called (rather than the callers of the wrapped error)