message search (#60)

This commit is contained in:
Sarv
2025-04-19 03:06:05 +08:00
committed by GitHub
parent 85b5465d2a
commit a745519451
19 changed files with 910 additions and 519 deletions

View File

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

View File

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