diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-08-27 23:20:42 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-08-27 23:20:42 (GMT) |
commit | 6b2e160d279c031d714206007e22df9e177de44e (patch) | |
tree | e71cc12755a8013d20a6feb73f680ac2d7399468 /Lib/smtplib.py | |
parent | 29646917c05a2d4ca7264191cb6568ddf6c09d04 (diff) | |
download | cpython-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.py | 6 |
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") |