diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 53fb381..bffe3b4 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -23,7 +23,9 @@ Changes Bug Fixes --------- - +* Selecting inexistent folders specified in folderincludes now throws + nice errors and continues to sync with all other folders rather than + exiting offlineimap with a traceback. Pending for the next major release ================================== diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 82d9e32..7b23d8e 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -24,6 +24,7 @@ from threading import Event import re import types import os +from sys import exc_info import netrc import errno @@ -307,7 +308,12 @@ class IMAPRepository(BaseRepository): for foldername in self.folderincludes: try: imapobj.select(foldername, readonly = 1) - except ValueError: + except OfflineImapError, e: + # couldn't select this folderinclude, so ignore folder. + if e.severity > OfflineImapError.ERROR.FOLDER: + raise + self.ui.error(e, exc_info()[2], + 'Invalid folderinclude:') continue retval.append(self.getfoldertype()(self.imapserver, foldername,