From 098c27d3da3d27e4a836751636f6247938a48be9 Mon Sep 17 00:00:00 2001 From: Silvan Date: Thu, 11 May 2023 18:02:34 +0200 Subject: [PATCH] fix: render authrequest id only if possible (#5823) --- internal/api/ui/login/renderer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/api/ui/login/renderer.go b/internal/api/ui/login/renderer.go index a9b12f19dc..5c20168d35 100644 --- a/internal/api/ui/login/renderer.go +++ b/internal/api/ui/login/renderer.go @@ -327,7 +327,12 @@ func (l *Login) chooseNextStep(w http.ResponseWriter, r *http.Request, authReq * func (l *Login) renderInternalError(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, err error) { var msg string if err != nil { - logging.WithError(err).WithField("auth_req_id", authReq.ID).Error() + log := logging.WithError(err) + if authReq != nil { + log = log.WithField("auth_req_id", authReq.ID) + } + log.Error() + _, msg = l.getErrorMessage(r, err) } data := l.getBaseData(r, authReq, "Errors.Internal", "", "Internal", msg)