From bf44d30b46d530b0c6723a2128b4cd5a8ba1ff95 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 17 Feb 2012 08:48:59 +0100 Subject: [PATCH] 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 --- offlineimap/folder/UIDMaps.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py index f306459..99ad2d3 100644 --- a/offlineimap/folder/UIDMaps.py +++ b/offlineimap/folder/UIDMaps.py @@ -82,7 +82,13 @@ class MappedIMAPFolder(IMAPFolder): if dolock: self.maplock.release() def _uidlist(self, mapping, items): - return [mapping[x] for x in items] + try: + 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): self._mb.cachemessagelist()