gpanic

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catch

func Catch()

Catches a panic (recovers from it) and prints it to stderr

func CatchAndCall added in v1.1.0

func CatchAndCall(id string, fcall func(id string, msg string, trc string))

Catches a panic (recovers from it) and calls the given callback function, preserving a convenience relation through an arbitrary string identifier passed as the first argument (id). It can also be used to set named return values of the parent function (set the values to return), when used with an inline callback function, thanks to closures.

func CatchAndDo added in v1.3.0

func CatchAndDo(fdo func(msg, trc string))

Catches a panic (recovers from it) and calls the given callback function, providing msg (error message) and trc (stack trace). This is intended mainly for usage withing closures deferment, in order to use the context of the caller in the callback fucntion. It can also be used to set named return values of the parent function (set the values to return), when used with an inline callback function, thanks to closures.

func CatchToFile added in v1.1.0

func CatchToFile(file *os.File)

Catches a panic (recovers from it) and prints it to a given file it can be used to print to stdout by passing os.Stdout as argument

func GetPanicInfo added in v1.2.0

func GetPanicInfo(panicErr interface{}) (msg string, trc string)

Get the info from the given panic object (do not provide something different than a panic to this function)

Types

This section is empty.

Jump to

Keyboard shortcuts

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