recovery

package
v0.0.0-...-d69904b Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package recovery provides an HTTP handler which recovers panics in an underlying handler, logs debug information about the panic, and returns a 500 Internal Server Error to the client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogOnPanic

func LogOnPanic(id int64, err interface{}, stacktrace []string, _ *http.Request)

LogOnPanic logs the given panic and its stacktrace, prefixing each line with the panic ID.

func Wrap

func Wrap(h http.Handler, onPanic PanicHandler) http.Handler

Wrap returns an handler which proxies requests to the given handler, but handles panics by logging the stack trace and returning a 500 Internal Server Error to the client, if possible.

Types

type PanicHandler

type PanicHandler func(id int64, err interface{}, stacktrace []string, request *http.Request)

PanicHandler is a handler for per-request panics.

Jump to

Keyboard shortcuts

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