mirror of
https://github.com/nais/wonderwall.git
synced 2026-08-20 03:26:22 +00:00
fix(handler/error): respect log level parameter in respondError
The previous if/else only checked for WarnLevel, causing any other
level (e.g. InfoLevel in 24fb9b1) to fall through to Errorf. Use Logf to
dispatch on the actual level passed by callers.
This commit is contained in:
@@ -105,11 +105,10 @@ func (s *Standalone) respondError(w http.ResponseWriter, r *http.Request, status
|
||||
return
|
||||
}
|
||||
|
||||
if level == log.WarnLevel || errors.Is(cause, context.Canceled) {
|
||||
logger.Warnf(msg, cause)
|
||||
} else {
|
||||
logger.Errorf(msg, cause)
|
||||
if errors.Is(cause, context.Canceled) {
|
||||
level = log.WarnLevel
|
||||
}
|
||||
logger.Logf(level, msg, cause)
|
||||
|
||||
logger.Infof("errorhandler: maximum retry attempts exceeded; executing error template...")
|
||||
span.SetAttributes(attribute.Bool("error.retries_exhausted", true))
|
||||
|
||||
Reference in New Issue
Block a user