Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) rex.Middleware
New creates a new recovery middleware with the given options
Types ¶
type Option ¶ added in v1.5.0
type Option func(*RecoveryConfig)
Option defines a function type for configuring RecoveryConfig
func WithErrorHandler ¶ added in v1.5.0
WithErrorHandler sets a custom error handler
func WithExposeErrors ¶ added in v1.5.0
WithExposeErrors configures whether to expose error details to clients
func WithLogger ¶ added in v1.5.0
WithLogger sets a custom logger
func WithProductionMessage ¶ added in v1.5.0
WithProductionMessage sets a custom error message for production
func WithStackTrace ¶ added in v1.5.0
WithStackTrace configures whether to log stack traces
type RecoveryConfig ¶ added in v1.5.0
type RecoveryConfig struct { // Whether to include stack trace in logs StackTrace bool // Custom error handler - if provided, it handles the error completely ErrorHandler func(c *rex.Context, err error) // Custom logger - if not provided, uses standard log package Logger Logger // Whether to send error details to client (disable in production) ExposeErrors bool // Custom error message for production ProductionMessage string }
RecoveryConfig holds configuration for the recovery middleware
Click to show internal directories.
Click to hide internal directories.