Catch folderfilter errors in repository.IMAP.getfolders()
Rather than throwing ValueError, we now properly throw OfflineImapError when selecting a folder in folderincludes. So we also need to catch OfflineImapErrors here. If they are of severity FOLDER, just ignore the invalid folder and continue. If the error is more severe, bubble it up. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
f6b9c68333
commit
fa18968642
@ -23,7 +23,9 @@ Changes
|
|||||||
Bug Fixes
|
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
|
Pending for the next major release
|
||||||
==================================
|
==================================
|
||||||
|
@ -24,6 +24,7 @@ from threading import Event
|
|||||||
import re
|
import re
|
||||||
import types
|
import types
|
||||||
import os
|
import os
|
||||||
|
from sys import exc_info
|
||||||
import netrc
|
import netrc
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
@ -307,7 +308,12 @@ class IMAPRepository(BaseRepository):
|
|||||||
for foldername in self.folderincludes:
|
for foldername in self.folderincludes:
|
||||||
try:
|
try:
|
||||||
imapobj.select(foldername, readonly = 1)
|
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
|
continue
|
||||||
retval.append(self.getfoldertype()(self.imapserver,
|
retval.append(self.getfoldertype()(self.imapserver,
|
||||||
foldername,
|
foldername,
|
||||||
|
Loading…
Reference in New Issue
Block a user