diff --git a/app/brahma/api/murder/main.go b/app/brahma/api/murder/main.go index 03763ac..7e043bf 100755 --- a/app/brahma/api/murder/main.go +++ b/app/brahma/api/murder/main.go @@ -52,7 +52,7 @@ func appInit() { //requestId app.Use(requestid.New()) //recover - app.Use(api.FibberRecoverHandler) + app.Use(api.FibberMiddleWareRecoverHandler) //requestId for gorm app.Use(api.FibberUserCtxWithTraceHandler) } diff --git a/app/zeus/api/lark/main.go b/app/zeus/api/lark/main.go index 4cbb6d4..c6216de 100755 --- a/app/zeus/api/lark/main.go +++ b/app/zeus/api/lark/main.go @@ -10,9 +10,9 @@ import ( func main() { router := fiber.New(fiber.Config{ AppName: "api-lark", - ErrorHandler: api.FiberErrHandler, + ErrorHandler: api.FiberMiddleWareErrHandler, }) - router.Use(api.FibberRespHandler) + router.Use(api.FibberMiddleWareRespHandler) userRouter := router.Group("/user") userRouter.Post("/login", user.LoginHandle) diff --git a/pkg/api/fiber.go b/pkg/api/fiber.go index bb8c8c4..dd91f1e 100644 --- a/pkg/api/fiber.go +++ b/pkg/api/fiber.go @@ -11,8 +11,8 @@ import ( "runtime" ) -// FiberErrHandler fiber 错误处理的中间件 -func FiberErrHandler(ctx *fiber.Ctx, err error) error { +// FiberMiddleWareErrHandler fiber 错误处理的中间件 +func FiberMiddleWareErrHandler(ctx *fiber.Ctx, err error) error { code := fiber.StatusInternalServerError msg := "" @@ -31,8 +31,8 @@ func FiberErrHandler(ctx *fiber.Ctx, err error) error { }) } -// FibberRespHandler fiber resp的统一处理 -func FibberRespHandler(c *fiber.Ctx) error { +// FibberMiddleWareRespHandler fiber resp的统一处理 +func FibberMiddleWareRespHandler(c *fiber.Ctx) error { err := c.Next() if err != nil { return err @@ -50,8 +50,8 @@ func FibberRespHandler(c *fiber.Ctx) error { return nil } -// FibberRecoverHandler fiberPanicRecover -func FibberRecoverHandler() fiber.Handler { +// FibberMiddleWareRecoverHandler fiberPanicRecover +func FibberMiddleWareRecoverHandler() fiber.Handler { return recover.New(recover.Config{ EnableStackTrace: true, StackTraceHandler: func(c *fiber.Ctx, e interface{}) {