Source File
config.go
Belonging Package
github.com/gofiber/fiber/v2/middleware/recover
package recover //nolint:predeclared // TODO: Rename to some non-builtin
import (
)
// Config defines the config for middleware.
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
// EnableStackTrace enables handling stack trace
//
// Optional. Default: false
EnableStackTrace bool
// StackTraceHandler defines a function to handle stack trace
//
// Optional. Default: defaultStackTraceHandler
StackTraceHandler func(c *fiber.Ctx, e interface{})
}
// ConfigDefault is the default config
var ConfigDefault = Config{
Next: nil,
EnableStackTrace: false,
StackTraceHandler: defaultStackTraceHandler,
}
// Helper function to set default values
func configDefault( ...Config) Config {
// Return default config if nothing provided
if len() < 1 {
return ConfigDefault
}
// Override default config
:= [0]
if .EnableStackTrace && .StackTraceHandler == nil {
.StackTraceHandler = defaultStackTraceHandler
}
return
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |