]> code.delx.au - offlineimap/commitdiff
return 0 rather than raise exception to indicate that message was saved with unknown UID
authorAdam Spiers <darcs@adamspiers.org>
Tue, 16 May 2006 02:34:46 +0000 (03:34 +0100)
committerAdam Spiers <darcs@adamspiers.org>
Tue, 16 May 2006 02:34:46 +0000 (03:34 +0100)
offlineimap/folder/IMAP.py

index 45978b592b625e136b1f1a2471548a1a1db70cbf..50dd20baa1e290c6fe7bbcf294be7eac6b796829 100644 (file)
@@ -161,11 +161,13 @@ class IMAPFolder(BaseFolder):
             matchinguids = imapobj.uid('search', 'HEADER', headername, headervalue)[1][0]
         except imapobj.error, err:
             # IMAP server doesn't implement search or had a problem.
-            raise ValueError, "Got IMAP error while attempting to find UID for message with header %s: %s" % (headername, err)
+            ui.debug('imap', "savemessage_searchforheader: got IMAP error '%s' while attempting to UID SEARCH for message with header %s" % (err, headername)
+            return 0
         ui.debug('imap', 'savemessage_searchforheader got initial matchinguids: ' + repr(matchinguids))
 
         if matchinguids == '':
-            raise ValueError, "Search for UID for message with header %s yielded no results" % headername
+            ui.debug('imap', "savemessage_searchforheader: UID SEARCH for message with header %s yielded no results" % headername)
+            return 0
 
         matchinguids = matchinguids.split(' ')
         ui.debug('imap', 'savemessage_searchforheader: matchinguids now ' + \