Title: error wording nitpick
Type: rfe Severity: normal
Components: Library Versions: 2.5b1
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, dmbaggett
Priority: Keywords:

Created on 2009-03-20.00:14:30 by dmbaggett, last changed 2009-03-21.13:52:01 by amak.

msg4314 (view) Author: Dave Baggett (dmbaggett) Date: 2009-03-20.00:14:29
Host lookup failures return "getaddrinfo failed" in the exception. I
actually show the exception text to users, and think it would be less
confusing for them if it said "Unknown Host".
msg4319 (view) Author: Alan Kennedy (amak) Date: 2009-03-21.11:07:34
We follow cpython, and so use the same message as them

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo('somehost', 9999)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: (11001, 'getaddrinfo failed')

If you can persuade the cpython folks to change their message, then we
can follow.

I don't expect that this will ever change.

Personally, I'd just use something like

err_msg = None
    addr_info = socket.getaddrinfo(host, port, etc)
except socket.gaierror:
    err_msg = "Unknown host"
msg4320 (view) Author: Dave Baggett (dmbaggett) Date: 2009-03-21.13:38:17
Ah, didn't realize that cpython did the same thing. I'm actually passing
back messages from smtplib, and the socket errors are just some of the
various kinds of exceptions that you can get back. But obviously I can
still handle this error manually, along the lines you suggest.
msg4321 (view) Author: Alan Kennedy (amak) Date: 2009-03-21.13:52:01
OK, so I'm closing this RFE.

Thanks for your attention to detail.
Date User Action Args
2009-03-21 13:52:01amaksetstatus: open -> closed
assignee: amak
resolution: rejected
messages: + msg4321
2009-03-21 13:38:18dmbaggettsetmessages: + msg4320
2009-03-21 11:07:35amaksetnosy: + amak
messages: + msg4319
2009-03-20 00:14:30dmbaggettcreate