panics

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PanicHandlers = []PanicHandler{logHandler}
View Source
var ReallyCrash = true

Functions

func HandlePanic

func HandlePanic(additionalHandlers ...PanicHandler)

func PropagatePanicAsError

func PropagatePanicAsError(errp *error, callStandardHandlers bool, additionalHandlers ...PanicHandler)

PropagatePanicAsError is intended to be called via defer to map a recovered panic to an error and propagate it to the error return value of the calling function. Use: defer panics.PropagatePanicAsError(&err, false) It incorporates the originally returned error by the surrounding function and all errors provided by the panic handlers plus the mapped recovered panic.

func RegisterPanicHandler

func RegisterPanicHandler(handler PanicHandler)

RegisterPanicHandler adds handlers to the panic handler.

Types

type PanicHandler

type PanicHandler func(interface{}) error

Jump to

Keyboard shortcuts

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