telegramnotifier: fix err check

This commit is contained in:
c9s 2022-10-03 21:14:46 +08:00
parent 2b953ad2d1
commit 731e5569d0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -34,7 +34,7 @@ func (t *LogHook) Fire(e *logrus.Entry) error {
} }
var message = fmt.Sprintf("[%s] %s", e.Level.String(), e.Message) var message = fmt.Sprintf("[%s] %s", e.Level.String(), e.Message)
if errData, ok := e.Data[logrus.ErrorKey]; ok { if errData, ok := e.Data[logrus.ErrorKey]; ok && errData != nil {
if err, isErr := errData.(error); isErr { if err, isErr := errData.(error); isErr {
message += " Error: " + err.Error() message += " Error: " + err.Error()
} }