errors

package
v1.50.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: MIT Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

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

Errorf formats according to a format specifier and returns the string as a value that satisfies error.

func New

func New(text string) error

New returns an error that formats as the given text.

func Walk

func Walk(err error, f WalkFunc)

Walk invokes the given function for each error in the chain. If the provided functions returns true or no further cause can be found, the process is stopped and no further calls will be made.

The next error in the chain is determined by the following rules:

  • If the current error has a `Cause() error` method (github.com/pkg/errors), the return value of this method is used.
  • If the current error has a `Unwrap() error` method (golang.org/x/xerrors), the return value of this method is used.
  • Common errors in the Go runtime that contain an Err field will use this value.

Types

type WalkFunc

type WalkFunc func(error) bool

WalkFunc is the signature of the Walk callback function. The function gets the current error in the chain and should return true if the chain processing should be aborted.

Jump to

Keyboard shortcuts

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