test

package
v0.4.71 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrErrpNil = errors.New("errp cannot be nil")

ErrErrpNil indicates that a function with an error pointer argument received an errp nil value.

if errors.Is(err, ErrErrpNil) …

Functions

func Annotation

func Annotation() (annotation string)

Annotation provides a default annotation [base package].[function]: "mypackage.MyFunc"

func Log

func Log(format string, a ...interface{})

Log invocations always print and output to stderr. if debug is enabled, code location is appended.

func NoOnError

func NoOnError(err error)

NoOnError is used with Recover to silence the default error logging

func Recover

func Recover(annotation string, errp *error, onError func(error))

Recover recovers from a panic invoking a function no more than once. If there is *errp does not hold an error and there is no panic, onError is not invoked. Otherwise, onError is invoked exactly once. *errp is updated with a possible panic.

func RecoverInvocationPanic

func RecoverInvocationPanic(fn func(), errp *error)

RecoverInvocationPanic is intended to wrap callback invocations in the callee in order to recover from panics in the callback function. when an error occurs, perrors.AppendError appends the callback error to *errp. if fn is nil, a recovered panic results. if errp is nil, a panic is thrown, can be check with:

if errors.Is(err, ErrErrpNil) …

Types

This section is empty.

Jump to

Keyboard shortcuts

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