Documentation
¶
Overview ¶
Package recover provides panic recovery middleware for the aarv framework.
It catches panics in downstream handlers, logs the stack trace, and returns a 500 JSON error response instead of crashing the server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(config ...Config) aarv.Middleware
New creates a panic recovery middleware with optional configuration. If no config is provided, DefaultConfig is used.
Types ¶
type Config ¶
type Config struct {
// StackSize is the maximum size of the stack trace buffer in bytes.
// Default: 4096.
StackSize int
// DisableStackAll disables capturing the stack of all goroutines.
// When false (default), runtime.Stack is called with all=true.
DisableStackAll bool
// DisablePrintStack disables logging the stack trace.
// When true, the panic value is still logged but the stack trace is omitted.
DisablePrintStack bool
}
Config holds configuration for the recovery middleware.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default recovery configuration.
Click to show internal directories.
Click to hide internal directories.