panicerr

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package panicerr makes it easy to recover panics, and convert them to standard errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recover

func Recover(err *error)

Recover wraps the recover() built in, and is meant to be called in a defer statement. If a panic is recovered, it is converted to an error, with pkg/errors-compatible stack trace, and assigned to err.

Example:

func DoSomething() (err error) {}
    defer panicerr.Recover(&err)
    // ... code that may panic
    return nil
 }

func Recoverer

func Recoverer(reporter ale.ErrorReporter) func(http.Handler) http.Handler

Recoverer returns an HTTP middleware that catches panics, and sends them to reporter.

Types

type Frame

type Frame = errors.Frame

Frame is an alias to pkg/errors.Frame

type StackTrace

type StackTrace = errors.StackTrace

StackTrace is an alias to pkg/errors.StackTrace

Jump to

Keyboard shortcuts

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