mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Add log messages for mail errors (#727)
* adapt to starttls interface change in imap_tools pin imap-tools version to avoid breaking changes improve mail log * fix unittest * remove uneeded print and fix merge fail * bump to next version
This commit is contained in:
parent
ec5d80585d
commit
0d298d743a
2
Pipfile
2
Pipfile
@ -19,7 +19,7 @@ djangorestframework = "~=3.13"
|
||||
filelock = "*"
|
||||
fuzzywuzzy = {extras = ["speedup"], version = "*"}
|
||||
gunicorn = "*"
|
||||
imap-tools = "*"
|
||||
imap-tools = "~=0.54.0"
|
||||
langdetect = "*"
|
||||
pathvalidate = "*"
|
||||
pillow = "~=9.1"
|
||||
|
@ -156,7 +156,7 @@ class MailAccountHandler(LoggingMixin):
|
||||
self.log("debug", f"Processing mail account {account}")
|
||||
|
||||
total_processed_files = 0
|
||||
|
||||
try:
|
||||
with get_mailbox(
|
||||
account.imap_server,
|
||||
account.imap_port,
|
||||
@ -190,13 +190,20 @@ class MailAccountHandler(LoggingMixin):
|
||||
"Unable to authenticate with mail server using AUTH=PLAIN",
|
||||
)
|
||||
raise MailError(f"Error while authenticating account {account}")
|
||||
except Exception:
|
||||
self.log("error", "Unable to authenticate with mail server")
|
||||
raise MailError(f"Error while authenticating account {account}")
|
||||
except Exception as e:
|
||||
self.log(
|
||||
"error",
|
||||
f"Error while authenticating account {account}: {e}",
|
||||
exc_info=False,
|
||||
)
|
||||
raise MailError(
|
||||
f"Error while authenticating account {account}",
|
||||
) from e
|
||||
|
||||
self.log(
|
||||
"debug",
|
||||
f"Account {account}: Processing " f"{account.rules.count()} rule(s)",
|
||||
f"Account {account}: Processing "
|
||||
f"{account.rules.count()} rule(s)",
|
||||
)
|
||||
|
||||
for rule in account.rules.order_by("order"):
|
||||
@ -208,6 +215,14 @@ class MailAccountHandler(LoggingMixin):
|
||||
f"Rule {rule}: Error while processing rule: {e}",
|
||||
exc_info=True,
|
||||
)
|
||||
except MailError:
|
||||
raise
|
||||
except Exception as e:
|
||||
self.log(
|
||||
"error",
|
||||
f"Error while retrieving mailbox {account}: {e}",
|
||||
exc_info=False,
|
||||
)
|
||||
|
||||
return total_processed_files
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user