Provide better error message for invalid 'reference' setting
When e.g. specifying an invalid 'reference' value for an IMAP server to a root folder that does not exist, we would previously have crashed with a nonsensical and non-intuitive error message (trying to address an element of a NoneType). This will also raise an Exception (which should be ok, given that this is really a misconfiguration on the user side), but it will explain to the user WHY it exited. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
d05162675c
commit
0811beb03d
@ -302,6 +302,14 @@ class IMAPServer:
|
||||
# Some buggy IMAP servers do not respond well to LIST "" ""
|
||||
# Work around them.
|
||||
listres = imapobj.list(self.reference, '"*"')[1]
|
||||
if listres == [None] or listres == None:
|
||||
# No Folders were returned. This occurs, e.g. if the
|
||||
# 'reference' prefix does not exist on the mail
|
||||
# server. Raise exception.
|
||||
err = "Server '%s' returned no folders in '%s'" % \
|
||||
(self.repos.getname(), self.reference)
|
||||
self.ui.warn(err)
|
||||
raise Exception(err)
|
||||
self.delim, self.root = \
|
||||
imaputil.imapsplit(listres[0])[1:]
|
||||
self.delim = imaputil.dequote(self.delim)
|
||||
|
Loading…
Reference in New Issue
Block a user