Commit 55310da5 by 孙龙

up

parent b0140f98
Showing with 5 additions and 7 deletions
...@@ -4,10 +4,8 @@ import ( ...@@ -4,10 +4,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
common "golang-callback/app/common/function"
"golang-callback/util"
"github.com/ichunt2019/cfg/lib" "github.com/ichunt2019/cfg/lib"
"runtime/debug" common "golang-callback/app/common/function"
) )
// RecoveryMiddleware捕获所有panic,并且返回错误信息 // RecoveryMiddleware捕获所有panic,并且返回错误信息
...@@ -18,10 +16,10 @@ func RecoveryMiddleware() gin.HandlerFunc { ...@@ -18,10 +16,10 @@ func RecoveryMiddleware() gin.HandlerFunc {
if err := recover(); err != nil { if err := recover(); err != nil {
//先做一下日志记录 //先做一下日志记录
//fmt.Println(string(debug.Stack())) //fmt.Println(string(debug.Stack()))
util.ComLogNotice(c, "_com_panic", map[string]interface{}{ //util.ComLogNotice(c, "_com_panic", map[string]interface{}{
"error": fmt.Sprint(err), // "error": fmt.Sprint(err),
"stack": string(debug.Stack()), // "stack": string(debug.Stack()),
}) //})
if lib.Instance("proxy").GetString("base.debug_mode") != "debug" { if lib.Instance("proxy").GetString("base.debug_mode") != "debug" {
//ResponseError(c, 500, errors.New("内部错误")) //ResponseError(c, 500, errors.New("内部错误"))
common.Output(c,500,"内部错误",nil) common.Output(c,500,"内部错误",nil)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment