GuiImap: more error handling

This commit is contained in:
steffen123 2010-08-10 05:19:54 +02:00
parent 4da521eadc
commit 9dff572385

View File

@ -20,6 +20,7 @@ import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
from imaplib import IMAP4 from imaplib import IMAP4
from socket import gaierror
import ImapFetcher import ImapFetcher
@ -85,14 +86,14 @@ class GuiImapFetcher (threading.Thread):
self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show? self.statusLabel.set_label("Starting import. Please wait.") #FIXME: why doesnt this one show?
for email in self.config.emails: for email in self.config.emails:
try: try:
print "trying to run"
result=ImapFetcher.run(self.config.emails[email], self.db) result=ImapFetcher.run(self.config.emails[email], self.db)
self.statusLabel.set_label("Finished import without error.") self.statusLabel.set_label("Finished import without error.")
print "finished to run" except IMAP4.error as error:
except IMAP4.error as strerror: if str(error)=="[AUTHENTICATIONFAILED] Authentication failed.":
if str(strerror)=="[AUTHENTICATIONFAILED] Authentication failed.":
self.statusLabel.set_label("Login to mailserver failed: please check mailserver, username and password") self.statusLabel.set_label("Login to mailserver failed: please check mailserver, username and password")
except gaierror as error:
if str(error)=="[Errno -2] Name or service not known":
self.statusLabel.set_label("Could not connect to mailserver: check mailserver and use SSL settings and internet connectivity")
#def importAllClicked #def importAllClicked
def get_vbox(self): def get_vbox(self):