caddyhttp: Set http.error.message to the HandlerError message (#4971)

This commit is contained in:
Francis Lavoie 2022-08-23 01:31:07 -04:00 committed by GitHub
parent fe5f5dfd6a
commit 72541f1cb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -526,8 +526,9 @@ func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request {
if handlerErr, ok := err.(HandlerError); ok { if handlerErr, ok := err.(HandlerError); ok {
repl.Set("http.error.status_code", handlerErr.StatusCode) repl.Set("http.error.status_code", handlerErr.StatusCode)
repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode)) repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode))
repl.Set("http.error.trace", handlerErr.Trace)
repl.Set("http.error.id", handlerErr.ID) repl.Set("http.error.id", handlerErr.ID)
repl.Set("http.error.trace", handlerErr.Trace)
repl.Set("http.error.message", handlerErr.Err.Error())
} }
return r return r