Documentation
¶
Overview ¶
Package errors.
This package can be used as drop-in replacement for https://golang.org/pkg/errors package.
This package provide StackTrace function to get the stack trace.
Stack trace can be attached to any error by passing it to Trace function.
New, NewWithCause, and Errorf function will return error that have stack trace.
Index ¶
- func As(err error, target interface{}) bool
- func Catch(f func() error) (err error)
- func Errorf(format string, a ...interface{}) error
- func Format(err error) string
- func FormatWithDeep(err error, deep int) string
- func Go(report func(error), f func() error)
- func Is(err, target error) bool
- func New(text string) error
- func NewWithCause(text string, cause error) error
- func ParentStackTrace(err error) []trace.Location
- func StackTrace(err error) []trace.Location
- func Trace(err error) error
- func Unwrap(err error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Catch ¶ added in v2.0.2
run f, if f panic or returned some error, that error will be returned by this function
func Format ¶
Format representation of the Error, including stack trace.
Use err.Error() if you want to get just the error string
func FormatWithDeep ¶
like Format, but limit stack trace count by deep
func Go ¶ added in v2.0.2
Spawn go routine
run f, if f panic or returned some error, that error will be passed to report function
the non-nil reported error will return non-nil when passed to ParentStackTrace
func NewWithCause ¶
like New, but you can specify the cause error
func ParentStackTrace ¶ added in v2.0.1
Get paren goroutine stack trace of err
return nil if err doesn't have stack trace
Types ¶
This section is empty.