mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
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)
|
||||
if err != nil && errors.Is(err, proton.ErrImportSizeExceeded) {
|
||||
// Remap error so that Gluon does not put this message in the recovery mailbox.
|
||||
err = fmt.Errorf("%v: %w", err, connector.ErrMessageSizeExceedsLimits)
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, proton.ErrImportSizeExceeded) {
|
||||
// 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) {
|
||||
logrus.WithError(apiErr).WithField("Details", apiErr.DetailsToString()).Error("Failed to import message")
|
||||
} else {
|
||||
logrus.WithError(err).Error("Failed to import message")
|
||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) {
|
||||
logrus.WithError(apiErr).WithField("Details", apiErr.DetailsToString()).Error("Failed to import message")
|
||||
} else {
|
||||
logrus.WithError(err).Error("Failed to import message")
|
||||
}
|
||||
}
|
||||
|
||||
return msg, literal, err
|
||||
|
||||
Reference in New Issue
Block a user