diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-08-27 23:22:22 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-08-27 23:22:22 (GMT) |
commit | a5dba1abea05cf3b456b9cf2d1f95517adf8e10b (patch) | |
tree | 71dd46e656de87ea5f095f210ffe90b4ee02202a /Lib/smtplib.py | |
parent | 103940cc0f57162b8da5438445010ec658291139 (diff) | |
parent | 6b2e160d279c031d714206007e22df9e177de44e (diff) | |
download | cpython-a5dba1abea05cf3b456b9cf2d1f95517adf8e10b.zip cpython-a5dba1abea05cf3b456b9cf2d1f95517adf8e10b.tar.gz cpython-a5dba1abea05cf3b456b9cf2d1f95517adf8e10b.tar.bz2 |
Provide a better diagnosis on socket errors
Diffstat (limited to 'Lib/smtplib.py')
-rw-r--r-- | Lib/smtplib.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py index a4c0d89..68fc646 100644 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -363,8 +363,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") |