Skip to content

Commit

Permalink
Raise an error when folder selection is unsuccessful
Browse files Browse the repository at this point in the history
  • Loading branch information
snowwm committed Dec 6, 2023
1 parent 616e278 commit 2971876
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 2971876

Please sign in to comment.