fix: gracefully handle nil err in Logger
This handles the case where a null error is passed into the Logger without causing a null pointer dereference / segfault. There are currently a couple places that invoke this function with a nil error and were resulting in a segfault.
This commit is contained in:
parent
81dcf1617c
commit
00e00f019f
|
|
@ -57,9 +57,11 @@ func (l *Logger) Error(err error, msg string, kvList ...interface{}) {
|
|||
Args map[string]interface{}
|
||||
}{
|
||||
Msg: msg,
|
||||
Err: err.Error(),
|
||||
Args: map[string]interface{}{},
|
||||
}
|
||||
if err != nil {
|
||||
payload.Err = err.Error()
|
||||
}
|
||||
if len(kvList)%2 != 0 {
|
||||
kvList = append(kvList, "<no-value>")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue