Skip to content

Commit

Permalink
Merge pull request #242 from snowwm/patch-1
Browse files Browse the repository at this point in the history
Raise an error when folder selection is unsuccessful
  • Loading branch information
martinrusev committed Apr 16, 2024
2 parents 616e278 + 2971876 commit df26574
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imbox/imbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def messages(self, **kwargs):
messages_class = GmailMessages

if folder:
self.connection.select(
status, data = self.connection.select(
messages_class.FOLDER_LOOKUP.get((folder.lower())) or folder)
if status != "OK":
raise imaplib.IMAP4.error(data[-1])
msg = " from folder '{}'".format(folder)
del kwargs['folder']
else:
Expand Down

0 comments on commit df26574

Please sign in to comment.