errors

package
v0.14.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

func Base

func Base(format string, a ...interface{}) error

Base returns a simple error with no stack trace attached

func Err

func Err(e interface{}, fmtParams ...interface{}) error

Err returns an error with stack trace

func FullTrace

func FullTrace(err error) string

FullTrace returns the error type, message, and stack trace

func HasTrace

func HasTrace(err error) bool

HasTrace checks if error has a trace attached

func Is

func Is(err, target error) bool

Is, As, and Unwrap call through to the builtin errors functions with the same name

func Prefix

func Prefix(prefix string, err interface{}) error

Prefix prefixes the message of the error with the given string

func Recover added in v0.14.3

func Recover(e *error)

Recover is similar to the bulitin `recover()`, except it includes a stack trace as well Since `recover()` only works when called inside a deferred function (but not any function called by it), you should call Recover() as follows

err := func() (e error) {
	defer errors.Recover(&e)
	funcThatMayPanic()
	return e
}()

func Trace

func Trace(err error) string

Trace returns the stack trace

func Unwrap

func Unwrap(err error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL