From 4bea1e3361fab29222f3ae3d2cbeca5c57f62714 Mon Sep 17 00:00:00 2001 From: Frederic Jahn Date: Mon, 29 Apr 2024 11:44:46 +0200 Subject: [PATCH] fix: don't override error before return (#1447) --- backend/handler/webauthn.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/handler/webauthn.go b/backend/handler/webauthn.go index 2b5cdfe5e..b4e496bf5 100644 --- a/backend/handler/webauthn.go +++ b/backend/handler/webauthn.go @@ -200,9 +200,9 @@ func (h *WebauthnHandler) FinishRegistration(c echo.Context) error { errorMessage = fmt.Sprintf("%s: %s: %s", errorMessage, err.Details, err.DevInfo) errorStatus = http.StatusUnprocessableEntity } - err = h.auditLogger.CreateWithConnection(tx, c, models.AuditLogWebAuthnRegistrationFinalFailed, user, errors.New(errorMessage)) - if err != nil { - return fmt.Errorf(CreateAuditLogFailureMessage, err) + aErr := h.auditLogger.CreateWithConnection(tx, c, models.AuditLogWebAuthnRegistrationFinalFailed, user, errors.New(errorMessage)) + if aErr != nil { + return fmt.Errorf(CreateAuditLogFailureMessage, aErr) } return echo.NewHTTPError(errorStatus, errorMessage).SetInternal(err)