fix : changeName
continuous-integration/drone/push Build was killed Details

master
liuhaotian 2022-01-13 15:27:19 +08:00
parent e1a46e17a4
commit 0c37f4363b
3 changed files with 9 additions and 9 deletions

View File

@ -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)
}

View File

@ -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)

View File

@ -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{}) {