mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-28 06:33:47 +03:00
caddyhttp: Fix for nil handlerErr.Err
(#4977)
This commit is contained in:
parent
72541f1cb8
commit
a22c08a638
1 changed files with 5 additions and 1 deletions
|
@ -528,7 +528,11 @@ func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request {
|
||||||
repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode))
|
repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode))
|
||||||
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.trace", handlerErr.Trace)
|
||||||
|
if handlerErr.Err != nil {
|
||||||
repl.Set("http.error.message", handlerErr.Err.Error())
|
repl.Set("http.error.message", handlerErr.Err.Error())
|
||||||
|
} else {
|
||||||
|
repl.Set("http.error.message", http.StatusText(handlerErr.StatusCode))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in a new issue