fix(GODT-2653): Only log when err is not nil
This commit is contained in:
@ -353,15 +353,17 @@ func (conn *imapConnector) CreateMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg, literal, err := conn.importMessage(ctx, literal, wantLabelIDs, wantFlags, unread)
|
msg, literal, err := conn.importMessage(ctx, literal, wantLabelIDs, wantFlags, unread)
|
||||||
if err != nil && errors.Is(err, proton.ErrImportSizeExceeded) {
|
if err != nil {
|
||||||
// Remap error so that Gluon does not put this message in the recovery mailbox.
|
if errors.Is(err, proton.ErrImportSizeExceeded) {
|
||||||
err = fmt.Errorf("%v: %w", err, connector.ErrMessageSizeExceedsLimits)
|
// Remap error so that Gluon does not put this message in the recovery mailbox.
|
||||||
}
|
err = fmt.Errorf("%v: %w", err, connector.ErrMessageSizeExceedsLimits)
|
||||||
|
}
|
||||||
|
|
||||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) {
|
if apiErr := new(proton.APIError); errors.As(err, &apiErr) {
|
||||||
logrus.WithError(apiErr).WithField("Details", apiErr.DetailsToString()).Error("Failed to import message")
|
logrus.WithError(apiErr).WithField("Details", apiErr.DetailsToString()).Error("Failed to import message")
|
||||||
} else {
|
} else {
|
||||||
logrus.WithError(err).Error("Failed to import message")
|
logrus.WithError(err).Error("Failed to import message")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg, literal, err
|
return msg, literal, err
|
||||||
|
|||||||
Reference in New Issue
Block a user