In the event of an error when setting the mail account folder, attempt to list the account's folders to the log

This commit is contained in:
Trenton Holmes
2022-04-19 08:32:34 -07:00
parent cc93616019
commit 33134d4529
2 changed files with 82 additions and 2 deletions

View File

@@ -190,6 +190,20 @@ class MailAccountHandler(LoggingMixin):
try:
M.folder.set(rule.folder)
except MailboxFolderSelectError:
self.log(
"error",
f"Unable to access folder {rule.folder}, attempting folder listing",
)
try:
for folder_info in M.folder.list():
self.log("info", f"Located folder: {str(folder_info)}")
except Exception:
self.log(
"error",
"Exception during folder listing, unable to provide list folders",
)
raise MailError(
f"Rule {rule}: Folder {rule.folder} "
f"does not exist in account {rule.account}",