1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-25 19:58:36 +00:00

Improve package API log handling (#35100)

Simplify code and fix log processing logic
This commit is contained in:
wxiaoguang
2025-07-17 00:25:49 +08:00
committed by GitHub
parent 37958e486a
commit f0da1de7e3
23 changed files with 101 additions and 132 deletions

View File

@@ -43,13 +43,12 @@ func apiError(ctx *context.Context, status int, obj any) {
Error Error `json:"error"`
}
helper.LogAndProcessError(ctx, status, obj, func(message string) {
jsonResponse(ctx, status, ErrorWrapper{
Error: Error{
Code: http.StatusText(status),
Message: message,
},
})
message := helper.ProcessErrorForUser(ctx, status, obj)
jsonResponse(ctx, status, ErrorWrapper{
Error: Error{
Code: http.StatusText(status),
Message: message,
},
})
}