d

package
v0.0.0-...-160d89c Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2016 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Chk = assert.New(&panicker{})
)

d.Chk.<Method>() -- used in test cases and as assertions

Functions

func CheckError

func CheckError(err error)

func CheckErrorNoUsage

func CheckErrorNoUsage(err error)

func PanicIfError

func PanicIfError(err error)

PanicIfError(err) && PanicIfTrue(expr, fmt, args) can be used to panic in a way that's easily handled by Try() and TryCatch()

func PanicIfNotType

func PanicIfNotType(err error, types ...interface{}) error

Utility method, that checks type of error and panics with wrapped error not one of the listed types.

func PanicIfTrue

func PanicIfTrue(b bool, msg string, args ...interface{})

If b evaluates to true, creates an error using msg and args, wraps it and panics.

func Try

func Try(f func(), types ...interface{}) (err error)

If 'f' panics with a WrappedError then recover that error. If types is empty, return the WrappedError. if types is not empty and cause is not one of the listed types, re-panic. if types is not empty and cause is one of the types, return 'cause'

func TryCatch

func TryCatch(f func(), catch func(err error) error) (err error)

If 'f' panics with a WrappedError then recover that error and return it. If types is empty, return the WrappedError. if types is not empty and cause is not one of the listed types, re-panic. if types is not empty and cause is one of the types, return 'cause'

func Unwrap

func Unwrap(err error) error

If err is a WrappedError, then Cause() is returned, otherwise returns err.

Types

type Exiter

type Exiter interface {
	Exit(code int)
}
var UtilExiter Exiter = nomsExiter{}

type WrappedError

type WrappedError interface {
	Error() string
	Cause() error
}

func Wrap

func Wrap(err error) WrappedError

Wraps an error. The enclosing error has a default Error() that contains the error msg along with a backtrace. The original error can be retrieved by calling err.Cause().

Jump to

Keyboard shortcuts

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