return 0 rather than raise exception to indicate that message was saved with unknown UID

This commit is contained in:
Adam Spiers 2006-05-16 03:34:46 +01:00
parent f11a49f263
commit f2d4c668d5

View File

@ -161,11 +161,13 @@ class IMAPFolder(BaseFolder):
matchinguids = imapobj.uid('search', 'HEADER', headername, headervalue)[1][0] matchinguids = imapobj.uid('search', 'HEADER', headername, headervalue)[1][0]
except imapobj.error, err: except imapobj.error, err:
# IMAP server doesn't implement search or had a problem. # 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)) ui.debug('imap', 'savemessage_searchforheader got initial matchinguids: ' + repr(matchinguids))
if 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(' ') matchinguids = matchinguids.split(' ')
ui.debug('imap', 'savemessage_searchforheader: matchinguids now ' + \ ui.debug('imap', 'savemessage_searchforheader: matchinguids now ' + \