mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
Catches OSError on IMAP connection error
When something goes wrong with the imaplib.IMAP4_SSL connection (like the host is temporarely down or the DNS does not resolve) it generates an OSError which is currently not catched and handled. Now OSErrors are translated to MailFetcherErrors which get logged and the IMAP connection is retried in the next IMAP check. Fixes #474
This commit is contained in:
parent
8de5d6799b
commit
e99bbb4e02
@ -216,7 +216,11 @@ class MailFetcher(Loggable):
|
||||
return r
|
||||
|
||||
def _connect(self):
|
||||
self._connection = imaplib.IMAP4_SSL(self._host, self._port)
|
||||
try:
|
||||
self._connection = imaplib.IMAP4_SSL(self._host, self._port)
|
||||
except OSError as e:
|
||||
msg = "Problem connecting to {}: {}".format(self._host, e.strerror)
|
||||
raise MailFetcherError(msg)
|
||||
|
||||
def _login(self):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user