fix handler exception

This commit is contained in:
白茶清欢 2025-05-10 20:46:37 +08:00
parent fcfba9c50b
commit 66c2ddad1c

View File

@ -44,7 +44,7 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
// 格式化验证错误的信息 // 格式化验证错误的信息
err = GetValidateErr(formValue, err) err = GetValidateErr(formValue, err)
e = exception.NewFromError(400, err) e = exception.NewFromError(400, err)
response.SendWithException(ctx, e, nil, &define.ResponseOption{ response.SendWithException(ctx, e, &define.ResponseOption{
ContentType: "application/json;charset=utf-8", ContentType: "application/json;charset=utf-8",
}) })
ctx.Abort() ctx.Abort()
@ -112,7 +112,7 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
"err": resList[1].Interface(), "err": resList[1].Interface(),
}) })
} }
response.SendWithException(ctx, e, nil, &define.ResponseOption{ response.SendWithException(ctx, e, &define.ResponseOption{
ContentType: "application/json;charset=utf-8", ContentType: "application/json;charset=utf-8",
}) })
return return