Skip to content

Commit 3957dc5

Browse files
check for nil error in LogError()
1 parent 50ae0fa commit 3957dc5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/logging/logger.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,10 @@ func RegisterLogger(l *logrus.Entry) {
9797

9898
// LogError is a helper function that allows for errors to be logged easily
9999
func LogError(err error, message string) {
100-
Log.WithError(err).Errorln(message)
100+
if err != nil {
101+
Log.WithError(err).Errorln(message)
102+
} else {
103+
Log.Warnln("LogError() called with nil error")
104+
Log.Errorln(message)
105+
}
101106
}

0 commit comments

Comments
 (0)