Files
cluster/internal/middleware/recovery.go
loveuer 29088a6b54 feat: complete OCI registry implementation with docker push/pull support
A lightweight OCI (Open Container Initiative) registry implementation written in Go.
2025-11-09 22:50:13 +08:00

25 lines
442 B
Go

package middleware
import (
"github.com/gofiber/fiber/v3"
)
// Recovery 恢复中间件
func Recovery() fiber.Handler {
return func(c fiber.Ctx) error {
defer func() {
if r := recover(); r != nil {
c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"errors": []fiber.Map{
{
"code": "INTERNAL_ERROR",
"message": "Internal server error",
},
},
})
}
}()
return c.Next()
}
}