Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( As = errors.As Unwrap = errors.Unwrap BasePath = "" BaseCachePath = "" BaseModule = "" MaxStackDepth = 32 MaxPrintStackFrames = 5 MaxPrintCauses = 5 )
Export a number of functions or variables from pkg/errors. We want people to be able to use them, if only via the entrypoints we've vetted in this file.
Functions ¶
func Is ¶
Detects whether the error is equal to a given error. Errors are considered equal by this function if they are matched by errors.Is or if their contained errors are matched through errors.Is
func RecoverPanic ¶
func RecoverPanic(r interface{}, errPtr *error)
RecoverPanic turns a panic into an error.
Example:
func Do() (err error) { defer func() { errors.RecoverPanic(recover(), &err) }() }
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) StackTrace ¶
func (e *Error) StackTrace() StackTrace
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.
func (Frame) Format ¶
Format formats the frame according to the fmt.Formatter interface.
%s source file relative to the compile time GOPATH %d source line %n function name without package
Format accepts flags that alter the printing of some verbs, as follows:
%+s full source file path %+n function name with package
type StackTrace ¶
type StackTrace []Frame
StackTrace is stack of Frames from innermost (newest) to outermost (oldest).