recoverer

package
v0.0.0-...-11149d6 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package recoverer provides a middleware that recovers from panics, logs the panic (and a backtrace), and returns a Custom status if possible.(based on go-chi/chi)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(w http.ResponseWriter, r *http.Request, _ any)

Handler is a function that handles a panic.

func New

func New(next http.Handler) http.Handler

New is a middleware that recovers from panics, uses the default options.

func NewWithOpts

func NewWithOpts(opts Options) func(next http.Handler) http.Handler

NewWithOpts is a middleware that recovers from panics, uses the provided options.

Types

type Options

type Options struct {
	Handler func(w http.ResponseWriter, r *http.Request, cause any)
}

Options is a struct for specifying configuration options for the middleware.

Jump to

Keyboard shortcuts

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