fix(core): 修复Save方法和panic错误处理

- 将Save方法中的Model操作从Save改为Create
- 更新panic日志格式,改进错误信息显示
- 修改错误响应消息为实际panic错误内容
This commit is contained in:
2026-02-03 15:09:41 +08:00
parent b704eee2bc
commit 60dcd37901
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ func ErrorHandler() gin.HandlerFunc {
return func(c *gin.Context) {
defer func() {
if err := recover(); err != nil {
log.Error("发生panic", "path", c.Request.URL.Path, "method", c.Request.Method, err)
response.Error(c).SetCode(http.StatusInternalServerError).SetMsg("服务器内部错误").End()
log.Error("发生panic=》", "path:", c.Request.URL.Path, ",method:", c.Request.Method, ",", err)
response.Error(c).SetCode(http.StatusInternalServerError).SetMsg(err.(error).Error()).End()
c.Abort()
}
}()