recovery

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package recovery provides panic recovery middleware for HTTP handlers.

The middleware recovers from panics in HTTP handlers and returns a 500 Internal Server Error response to the client. This prevents a single panicking request from crashing the entire server.

Basic Usage

mux := http.NewServeMux()
mux.HandleFunc("/", handler)
wrappedMux := recovery.Middleware(mux)
http.ListenAndServe(":8080", wrappedMux)

Stability

This package is Beta stability. The API may have minor changes before reaching stable status in v1.0.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware is an HTTP middleware that recovers from panics. When a panic occurs, it returns a 500 Internal Server Error response to the client, preventing the panic from crashing the server.

TODO(#7): Add configurable logging support once common logging is established across ToolHive. Currently panics are silently recovered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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