aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2006-11-01 19:49:47 +0000
committerNikolaus Schulz <microschulz@web.de>2006-11-01 19:49:47 +0000
commitc5f194f3ecd0170325a8c5aff9bc742c33242131 (patch)
treed3581c8fec80ab82986d069544dd30d3670e6a3b
parente872f2211e5506b602cefa4b4a9fa0a292dbff93 (diff)
downloadarchivemail-c5f194f3ecd0170325a8c5aff9bc742c33242131.tar.gz
archivemail-c5f194f3ecd0170325a8c5aff9bc742c33242131.tar.bz2
archivemail-c5f194f3ecd0170325a8c5aff9bc742c33242131.zip
Tightened some blanket exception handlers.
-rwxr-xr-xarchivemail.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/archivemail.py b/archivemail.py
index bbf52dc..71f40ba 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -1301,15 +1301,15 @@ def _archive_imap(mailbox_name, final_archive_name):
try:
imap_username, imap_str = imap_str.split('@', 1)
imap_server, imap_folder = imap_str.split('/', 1)
- except:
- unexpected_error("you must provide a properly formatted \
- IMAP connection string")
+ except ValueError:
+ unexpected_error("you must provide a properly formatted "
+ "IMAP connection string")
if options.pwfile:
imap_password = open(options.pwfile).read().rstrip()
else:
try:
imap_username, imap_password = imap_username.split(':', 1)
- except:
+ except ValueError:
imap_password = getpass.getpass()
if mailbox_name[:5] == 'imaps':
@@ -1320,7 +1320,7 @@ def _archive_imap(mailbox_name, final_archive_name):
vprint("connected to server %s" % imap_server)
try:
result, response = imap_srv.login_cram_md5(imap_username, imap_password)
- except:
+ except imaplib.IMAP4.error:
result, response = imap_srv.login(imap_username, imap_password)
if result != 'OK': unexpected_error("authentication failure")
vprint("logged in to server as %s" % imap_username)