Thu, 12 May 2011 19:56:33 +0200
Fixed an issue in the Email dialog reporting exceptions.
UI/EmailDialog.py | file | annotate | diff | comparison | revisions |
--- a/UI/EmailDialog.py Sun May 08 17:07:14 2011 +0200 +++ b/UI/EmailDialog.py Thu May 12 19:56:33 2011 +0200 @@ -282,10 +282,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) @@ -299,10 +305,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)