summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-08-27 23:20:42 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-08-27 23:20:42 (GMT)
commit6b2e160d279c031d714206007e22df9e177de44e (patch)
treee71cc12755a8013d20a6feb73f680ac2d7399468 /Lib/smtplib.py
parent29646917c05a2d4ca7264191cb6568ddf6c09d04 (diff)
downloadcpython-6b2e160d279c031d714206007e22df9e177de44e.zip
cpython-6b2e160d279c031d714206007e22df9e177de44e.tar.gz
cpython-6b2e160d279c031d714206007e22df9e177de44e.tar.bz2
Provide a better diagnosis on socket errors
Diffstat (limited to 'Lib/smtplib.py')
-rw-r--r--Lib/smtplib.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 7b97a6a..13c56e1 100644
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -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")