Просмотр исходного кода

Add fetch response to log when fetch response exception

Guénaël Muller 6 лет назад
Родитель
Сommit
64dae0307d
1 измененных файлов: 5 добавлений и 3 удалений
  1. 5 3
      tracim/tracim/lib/email_fetcher.py

+ 5 - 3
tracim/tracim/lib/email_fetcher.py Просмотреть файл

@@ -296,7 +296,8 @@ class MailFetcher(object):
296 296
 
297 297
             except BadIMAPFetchResponse as e:
298 298
                 log = 'Imap Fetch command return bad response.' \
299
-                      'Is someone else connected to the mailbox ?'
299
+                      'Is someone else connected to the mailbox ?: ' \
300
+                      '{}'
300 301
                 logger.error(self, log.format(e.__str__()))
301 302
             # Others
302 303
             except Exception as e:
@@ -372,7 +373,8 @@ class MailFetcher(object):
372 373
                 # This should happen only when someone-else use the mailbox
373 374
                 # at the same time of the fetcher.
374 375
                 # see https://github.com/mjs/imapclient/issues/334
375
-                raise BadIMAPFetchResponse from e
376
+                except_msg = 'fetch response : {}'.format(str(data))
377
+                raise BadIMAPFetchResponse(except_msg) from e
376 378
 
377 379
             msg_container = MessageContainer(msg, msgid)
378 380
             messages.append(msg_container)
@@ -398,7 +400,7 @@ class MailFetcher(object):
398 400
         #  if no from address for example) and catch it here
399 401
         while mails:
400 402
             mail = mails.pop()
401
-            body =  mail.get_body(
403
+            body = mail.get_body(
402 404
                 use_html_parsing=self.use_html_parsing,
403 405
                 use_txt_parsing=self.use_txt_parsing,
404 406
             )