MCPcopy
hub / github.com/gofiber/fiber / DefaultErrorHandler

Function DefaultErrorHandler

middleware/session/config.go:109–114  ·  view source on GitHub ↗

DefaultErrorHandler logs the error and sends a 500 status code. Parameters: - c: The Fiber context. - err: The error to handle. Usage: DefaultErrorHandler(c, err)

(c fiber.Ctx, err error)

Source from the content-addressed store, hash-verified

107//
108// DefaultErrorHandler(c, err)
109func DefaultErrorHandler(c fiber.Ctx, err error) {
110 log.Errorf("session error: %v", err)
111 if sendErr := c.Status(fiber.StatusInternalServerError).SendString("Internal Server Error"); sendErr != nil {
112 log.Errorf("failed to send error response: %v", sendErr)
113 }
114}
115
116// configDefault sets default values for the Config struct.
117//

Callers 3

TestDefaultErrorHandlerFunction · 0.70
handleSessionErrorFunction · 0.70
saveSessionMethod · 0.70

Calls 3

ErrorfFunction · 0.92
SendStringMethod · 0.65
StatusMethod · 0.65

Tested by 1

TestDefaultErrorHandlerFunction · 0.56