fix(core): 修复Save方法和panic错误处理
- 将Save方法中的Model操作从Save改为Create - 更新panic日志格式,改进错误信息显示 - 修改错误响应消息为实际panic错误内容
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user