errorx

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PanicOnError

func PanicOnError(err error)

PanicOnError panic when err is not nil

func UnwrapToRoot

func UnwrapToRoot(err error) error

UnwrapToRoot recursively unwrap the error chain, util the error is not a WrapError, and return this error.

func UnwrapUtil

func UnwrapUtil(err error, f func(e error) bool) error

UnwrapUtil unwrap the error chain, util the error meet the predicate func, and then return the error. If not found meet err, return nil

func Wrap

func Wrap(message string, err error) error

Wrap return a new error wrapped the origin error, with an additional message.

Types

type WrapError

type WrapError interface {
	error
	// Unwrap return the wrapped error
	Unwrap() error
}

WrapError is an interface for wrapped error. The error generated by fmt.Errorf with an origin error also implement this interface

Jump to

Keyboard shortcuts

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