panics

package
v0.0.0-...-6d3478e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package panics contains panic utility functions usable to handle panic recovery and stack trace generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Defer

func Defer(op func(), logfn func(*bytes.Buffer))

Defer provides a recovery handler functions for use to automate the recovery processes and logs out any panic that occurs.

func DeferReport

func DeferReport(op func(), logfn func(*bytes.Buffer))

DeferReport provides a recovery handler functions for use to automate the recovery processes and logs out any panic that occurs.

func GoDefer

func GoDefer(title string, fx func())

GoDefer lets you run a function inside a goroutine that gets a defer recovery, and reports to stdout if a panic occurs.

func GoDeferQuietly

func GoDeferQuietly(title string, fx func())

GoDeferQuietly lets you run a function inside a goroutine that gets a defer recovery but silently ignores the panic without logging to stdout.

func Guard

func Guard(fx func() error) error

Guard provides a function for handling panics safely, returning the error recieved after running a provided function.

func GuardDefer

func GuardDefer(fx func(interface{}) error) func(interface{}) error

GuardDefer returns a function which guarded by a defer..recover() for handling panic recover.

func GuardWith

func GuardWith(fx func(interface{}) error, d interface{}) error

GuardWith provides a function guard for a function in need of an in input

func LogRecoverHandler

func LogRecoverHandler(tag string, opFunc func() error) error

LogRecoverHandler provides a recovery handler functions for use to automate the recovery processes and logs out any panic that occurs.

func RecoverHandler

func RecoverHandler(tag string, opFunc func() error, recoFunc func(interface{})) error

RecoverHandler provides a recovery handler functions for use to automate the recovery processes

func ToString

func ToString(value interface{}, indent bool) string

ToString provides a string version of the value using json.Marshal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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