Fixed an issue in the Email dialog reporting exceptions.

Thu, 12 May 2011 19:56:12 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 12 May 2011 19:56:12 +0200
changeset 1027
75707baf9551
parent 1026
66888bc2913e
child 1029
0fb3d1d26eab

Fixed an issue in the Email dialog reporting exceptions.

UI/EmailDialog.py file | annotate | diff | comparison | revisions
--- a/UI/EmailDialog.py	Mon May 09 20:00:59 2011 +0200
+++ b/UI/EmailDialog.py	Thu May 12 19:56:12 2011 +0200
@@ -285,10 +285,16 @@
                     server.login(Preferences.getUser("MailServerUser"),
                                  password)
                 except (smtplib.SMTPException, socket.error) as e:
+                    if isinstance(e,  smtplib.SMTPResponseException):
+                        errorStr = e.smtp_error.decode()
+                    elif isinstance(e, socket.error):
+                        errorStr = e[1]
+                    else:
+                        errorStr = str(e)
                     res = E5MessageBox.retryAbort(self,
                         self.trUtf8("Send bug report"),
                         self.trUtf8("""<p>Authentication failed.<br>Reason: {0}</p>""")
-                            .format(str(e)),
+                            .format(errorStr),
                         E5MessageBox.Critical)
                     if res:
                         return self.__sendmail(msg)
@@ -302,10 +308,16 @@
             QApplication.restoreOverrideCursor()
         except (smtplib.SMTPException, socket.error) as e:
             QApplication.restoreOverrideCursor()
+            if isinstance(e,  smtplib.SMTPResponseException):
+                errorStr = e.smtp_error.decode()
+            elif isinstance(e, socket.error):
+                errorStr = e[1]
+            else:
+                errorStr = str(e)
             res = E5MessageBox.retryAbort(self,
                 self.trUtf8("Send bug report"),
                 self.trUtf8("""<p>Message could not be sent.<br>Reason: {0}</p>""")
-                    .format(str(e)),
+                    .format(errorStr),
                 E5MessageBox.Critical)
             if res:
                 return self.__sendmail(msg)

eric ide

mercurial