Browse Source

Add fetch response to log when fetch response exception

Guénaël Muller 6 years ago
parent
commit
64dae0307d
1 changed files with 5 additions and 3 deletions
  1. 5 3
      tracim/tracim/lib/email_fetcher.py

+ 5 - 3
tracim/tracim/lib/email_fetcher.py View File

296
 
296
 
297
             except BadIMAPFetchResponse as e:
297
             except BadIMAPFetchResponse as e:
298
                 log = 'Imap Fetch command return bad response.' \
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
                 logger.error(self, log.format(e.__str__()))
301
                 logger.error(self, log.format(e.__str__()))
301
             # Others
302
             # Others
302
             except Exception as e:
303
             except Exception as e:
372
                 # This should happen only when someone-else use the mailbox
373
                 # This should happen only when someone-else use the mailbox
373
                 # at the same time of the fetcher.
374
                 # at the same time of the fetcher.
374
                 # see https://github.com/mjs/imapclient/issues/334
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
             msg_container = MessageContainer(msg, msgid)
379
             msg_container = MessageContainer(msg, msgid)
378
             messages.append(msg_container)
380
             messages.append(msg_container)
398
         #  if no from address for example) and catch it here
400
         #  if no from address for example) and catch it here
399
         while mails:
401
         while mails:
400
             mail = mails.pop()
402
             mail = mails.pop()
401
-            body =  mail.get_body(
403
+            body = mail.get_body(
402
                 use_html_parsing=self.use_html_parsing,
404
                 use_html_parsing=self.use_html_parsing,
403
                 use_txt_parsing=self.use_txt_parsing,
405
                 use_txt_parsing=self.use_txt_parsing,
404
             )
406
             )