[Duplicity-talk] Version 0.5.04 suggestion: improve error handling
From:
Michael Schneider
Subject:
[Duplicity-talk] Version 0.5.04 suggestion: improve error handling
Date:
Sun, 28 Dec 2008 18:58:27 +0100
When a invalid mailbox is supplied to the gmail-backend, duplicity 0.5.04 dies with a counter-intuitive error message:
[..stuff deleted...] File "/usr/lib/python2.6/imaplib.py", line 1059, in _simple_command
return self._command_complete(name, self._command(name, *args)) File "/usr/lib/python2.6/imaplib.py", line 819, in _command ', '.join(Commands[name]))) error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
I suggest to add the standard error-handling to select(gmail_mailbox) to gmailimapbackend.py line 119 by changing
*** 116,122 ****
def list(self): ret = [] ! self._conn.select(gmail_mailbox)
# Going to find all the archives which have remote_dir in the From # address --- 116,124 ----
def list(self): ret = [] ! (result, list) = self._conn.select(gmail_mailbox)
! if result!="OK": ! raise Exception(list[0])
# Going to find all the archives which have remote_dir in the From # address
This results in a much more usable error message (my mailbox is [Google Mail]/All Mail):
[...deleted..] File "/usr/lib/python2.6/site-packages/duplicity/backends/gmailimapbackend.py", line 121, in list raise Exception(list[0]) Exception: Unknown Mailbox: [GMail]/All Mail (Failure)
I'm not sure wether the other calls to self._conn.select(gmail_mailbox) in gmailimapbackend.py should be treated the same way. As far as I understand duplicity, GmailImapBackend.list is called before any "dangerous" operation, so it should be sufficient to check the existence of the mailbox there.
Cheers, Michael
[Prev in Thread]
Current Thread
[Next in Thread]
[Duplicity-talk] Version 0.5.04 suggestion: improve error handling,
Michael Schneider<=