diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-04-10 15:10:24 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-04-10 15:10:24 +0200 |
| commit | e145f2b0c8831ec8756307b6b70c82f8dcdcab54 (patch) | |
| tree | 93406d01e313cfecdeac03132c1cccb55ff05088 /addons/mail/models/mail_mail.py | |
| parent | 3f95b074e959f0f4ac93fbf4048c0c7276f2c17a (diff) | |
| parent | 2694174b410f14ca81f0681ff4ae6856ff459ced (diff) | |
[MERGE] forward port branch saas-12.2 up to 2694174b410
Diffstat (limited to 'addons/mail/models/mail_mail.py')
| -rw-r--r-- | addons/mail/models/mail_mail.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/mail/models/mail_mail.py b/addons/mail/models/mail_mail.py index f758456c77e..a2ba820656f 100644 --- a/addons/mail/models/mail_mail.py +++ b/addons/mail/models/mail_mail.py @@ -5,6 +5,7 @@ import base64 import datetime import logging import psycopg2 +import smtplib import threading import re @@ -394,11 +395,12 @@ class MailMail(models.Model): mail.id, mail.message_id) # mail status will stay on ongoing since transaction will be rollback raise - except psycopg2.Error: - # If an error with the database occurs, chances are that the cursor is unusable. - # This will lead to an `psycopg2.InternalError` being raised when trying to write - # `state`, shadowing the original exception and forbid a retry on concurrent - # update. Let's bubble it. + except (psycopg2.Error, smtplib.SMTPServerDisconnected): + # If an error with the database or SMTP session occurs, chances are that the cursor + # or SMTP session are unusable, causing further errors when trying to save the state. + _logger.exception( + 'Exception while processing mail with ID %r and Msg-Id %r.', + mail.id, mail.message_id) raise except Exception as e: failure_reason = tools.ustr(e) |
