1
0

merge: 合并代码20241018

This commit is contained in:
TsMask
2024-10-18 17:26:59 +08:00
parent 49860c2f28
commit 17f57175c7
289 changed files with 21476 additions and 12863 deletions

View File

@@ -20,14 +20,14 @@ func ErrorCatch() gin.HandlerFunc {
// 返回错误响应给客户端
if config.Env() == "prod" {
c.JSON(500, result.ErrMsg("Internal Server Errors"))
c.JSON(500, result.CodeMsg(500, "Internal Server Errors"))
} else {
// 通过实现 error 接口的 Error() 方法自定义错误类型进行捕获
switch v := err.(type) {
case error:
c.JSON(500, result.ErrMsg(v.Error()))
c.JSON(500, result.CodeMsg(500, v.Error()))
default:
c.JSON(500, result.ErrMsg(fmt.Sprint(err)))
c.JSON(500, result.CodeMsg(500, fmt.Sprint(err)))
}
}