1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-19 01:29:40 +02:00

fix(packages): skip another stack frame from logging (#8530)

Log the right stack frame line. We currently always show the `apiError` method call.

related to #8529

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8530
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Michael Kriese 2025-07-16 18:07:19 +02:00 committed by Earl Warren
parent ec8c0a50c2
commit 09c9108a35

View file

@ -25,7 +25,8 @@ func LogAndProcessError(ctx *context.Context, status int, obj any, cb func(strin
message = fmt.Sprintf("%s", obj) message = fmt.Sprintf("%s", obj)
} }
if status == http.StatusInternalServerError { if status == http.StatusInternalServerError {
log.ErrorWithSkip(1, message) // LogAndProcessError is always wrapped in a `apiError` call, so we need to skip two frames
log.ErrorWithSkip(2, message)
if setting.IsProd && (ctx.Doer == nil || !ctx.Doer.IsAdmin) { if setting.IsProd && (ctx.Doer == nil || !ctx.Doer.IsAdmin) {
message = "" message = ""