132 if isinstance(e, smtplib.SMTPResponseException): |
132 if isinstance(e, smtplib.SMTPResponseException): |
133 errorStr = e.smtp_error.decode() |
133 errorStr = e.smtp_error.decode() |
134 elif isinstance(e, socket.timeout): |
134 elif isinstance(e, socket.timeout): |
135 errorStr = str(e) |
135 errorStr = str(e) |
136 elif isinstance(e, socket.error): |
136 elif isinstance(e, socket.error): |
137 errorStr = e[1] |
137 try: |
|
138 errorStr = e[1] |
|
139 except TypeError: |
|
140 errorStr = str(e) |
138 else: |
141 else: |
139 errorStr = str(e) |
142 errorStr = str(e) |
140 E5MessageBox.critical(self, |
143 E5MessageBox.critical(self, |
141 self.trUtf8("Login Test"), |
144 self.trUtf8("Login Test"), |
142 self.trUtf8("""<p>The login test failed.<br>Reason: {0}</p>""") |
145 self.trUtf8("""<p>The login test failed.<br>Reason: {0}</p>""") |
147 if isinstance(e, smtplib.SMTPResponseException): |
150 if isinstance(e, smtplib.SMTPResponseException): |
148 errorStr = e.smtp_error.decode() |
151 errorStr = e.smtp_error.decode() |
149 elif isinstance(e, socket.timeout): |
152 elif isinstance(e, socket.timeout): |
150 errorStr = str(e) |
153 errorStr = str(e) |
151 elif isinstance(e, socket.error): |
154 elif isinstance(e, socket.error): |
152 errorStr = e[1] |
155 try: |
|
156 errorStr = e[1] |
|
157 except TypeError: |
|
158 errorStr = str(e) |
153 else: |
159 else: |
154 errorStr = str(e) |
160 errorStr = str(e) |
155 E5MessageBox.critical(self, |
161 E5MessageBox.critical(self, |
156 self.trUtf8("Login Test"), |
162 self.trUtf8("Login Test"), |
157 self.trUtf8("""<p>The login test failed.<br>Reason: {0}</p>""") |
163 self.trUtf8("""<p>The login test failed.<br>Reason: {0}</p>""") |