message search (#60)
This commit is contained in:
@@ -65,7 +65,7 @@ func Newf(cause error, code int, format string, args ...interface{}) *Error {
|
||||
return &Error{
|
||||
Message: fmt.Sprintf(format, args...),
|
||||
Cause: cause,
|
||||
Code: http.StatusInternalServerError,
|
||||
Code: code,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package errors
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
@@ -50,7 +51,7 @@ func RecoveryMiddleware() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// 记录错误日志
|
||||
log.Err(err).Msg("PANIC RECOVERED")
|
||||
log.Err(err).Msgf("PANIC RECOVERED\n%s", string(debug.Stack()))
|
||||
|
||||
// 返回 500 错误
|
||||
c.JSON(http.StatusInternalServerError, err)
|
||||
|
||||
Reference in New Issue
Block a user