Documentation ¶
Overview ¶
Package errorutil provides utilities to handle errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame.
func (Frame) Format ¶
Format formats the frame according to the fmt.Formatter interface.
%s source file %d source line %n function name %v equivalent to %s:%d
Format accepts flags that alter the printing of some verbs, as follows:
%+s function name and path of source file %+v equivalent to %+s:%d
func (Frame) MarshalText ¶
MarshalText formats a stacktrace Frame as a text string. The output is the same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
type StackError ¶
type StackError struct {
// contains filtered or unexported fields
}
StackError is a wrapper error that provides a stacktrace for the error.
func (*StackError) Error ¶
func (e *StackError) Error() string
func (*StackError) StackTrace ¶
func (e *StackError) StackTrace() StackTrace
func (*StackError) Unwrap ¶
func (e *StackError) Unwrap() error
type StackTrace ¶
type StackTrace []Frame
StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
func GenerateStackTrace ¶
func GenerateStackTrace(skip int) StackTrace
GenerateStackTrace generates a StackTrace. It skips the given amount of callers.
func (StackTrace) Format ¶
func (st StackTrace) Format(s fmt.State, verb rune)
Format formats the stack of Frames according to the fmt.Formatter interface.
%s lists source files for each Frame in the stack %v lists the source file and line number for each Frame in the stack
Format accepts flags that alter the printing of some verbs, as follows:
%+v Prints filename, function, and line number for each Frame in the stack.
func (StackTrace) String ¶
func (st StackTrace) String() string