UIDMaps: Better error message when not finding a mapping

Bail out with a better Exception and error text. The whole mapped
UID situation needs to be improved though.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-02-17 08:48:59 +01:00
parent 7da50e638d
commit bf44d30b46

View File

@ -82,7 +82,13 @@ class MappedIMAPFolder(IMAPFolder):
if dolock: self.maplock.release() if dolock: self.maplock.release()
def _uidlist(self, mapping, items): def _uidlist(self, mapping, items):
try:
return [mapping[x] for x in items] return [mapping[x] for x in items]
except KeyError as e:
raise OfflineImapError("Could not find UID for msg '{0}' (f:'{1}'."
" This is usually a bad thing and should be reported on the ma"
"iling list.".format(e.args[0], self),
OfflineImapError.ERROR.MESSAGE)
def cachemessagelist(self): def cachemessagelist(self):
self._mb.cachemessagelist() self._mb.cachemessagelist()