]> granicus.if.org Git - python/commitdiff
Provide a better diagnosis on socket errors
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 27 Aug 2011 23:20:42 +0000 (01:20 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 27 Aug 2011 23:20:42 +0000 (01:20 +0200)
Lib/smtplib.py

index 7b97a6a88ffdad828a98390b923db37b1b7a5385..13c56e196f8b4432591959ca53c4bef260706fe8 100644 (file)
@@ -364,8 +364,10 @@ class SMTP:
         while 1:
             try:
                 line = self.file.readline()
-            except socket.error:
-                line = ''
+            except socket.error as e:
+                self.close()
+                raise SMTPServerDisconnected("Connection unexpectedly closed: "
+                                             + str(e))
             if not line:
                 self.close()
                 raise SMTPServerDisconnected("Connection unexpectedly closed")