Browse Source
http: Avoid panic if handler errors lack underlying error value
Fixes #2845
master
Matthew Holt
6 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
1 changed files with
5 additions and
1 deletions
-
modules/caddyhttp/server.go
|
|
@ -368,7 +368,11 @@ type ServerLogConfig struct { |
|
|
|
func errLogValues(err error) (status int, msg string, fields []zapcore.Field) { |
|
|
|
if handlerErr, ok := err.(HandlerError); ok { |
|
|
|
status = handlerErr.StatusCode |
|
|
|
if handlerErr.Err == nil { |
|
|
|
msg = err.Error() |
|
|
|
} else { |
|
|
|
msg = handlerErr.Err.Error() |
|
|
|
} |
|
|
|
fields = []zapcore.Field{ |
|
|
|
zap.Int("status", handlerErr.StatusCode), |
|
|
|
zap.String("err_id", handlerErr.ID), |
|
|
|