Documentation
¶
Overview ¶
Copied (and modified) from: github.com/pkg/errors@v0.9.1/stack.go
Index ¶
- func As(err error, target interface{}) bool
- func Cause(err error) error
- func InternalCode(err error) string
- func Is(err, target error) bool
- func New(internalCode string, format string, values ...interface{}) error
- func Unwrap(err error) error
- func Wrap(internalCode string, err error) error
- type Frame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true. Otherwise, it returns false. See: https://golang.org/pkg/errors/#As
func Cause ¶
Cause of the error. This returns the very first error encoutered whether that was a new application error or an external error.
func InternalCode ¶ added in v0.1.0
InternalCode of the first error created or wrapped. If err does not have an internal code then return empty string.
func Is ¶
Is reports whether any error in err's chain matches target. See: https://golang.org/pkg/errors/#Is
func New ¶
New error. This should be called when the application creates a brand new error. If an error has been received from an external function or is propogating an error, use Wrap().
func Unwrap ¶
Unwrap returns the result of calling the Unwrap method on err, if err's type contains an Unwrap method returning error. Otherwise, Unwrap returns nil. See: https://golang.org/pkg/errors/#Unwrap
Types ¶
type Frame ¶ added in v0.1.0
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 ¶ added in v0.1.0
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 relative to the compile time
GOPATH separated by \n\t (<funcname>\n\t<path>)
%+v equivalent to %+s:%d