On Mon, 12 Sep 2011 18:55:42 +0100, David Nadlinger <[email protected]> wrote:

On 9/12/11 4:11 PM, Vladimir Panteleev wrote:
* Currently, reverse hostname lookup functions throw on failure. Such
lookups are not reliable and are expected to sometimes fail, so perhaps
a more appropriate behavior would be to return the requested IP address
unchanged, or a value indicating failure (null or false).

As discussed on IRC, throwing on reverse lookup failure seems very wrong to me, as it is certainly expected. In my opinion, the best solution would be to return null (empty string), but I am not certain if it should still throw if something went wrong during lookup (besides the IP address not being found).

I agree. To me, throwing on lookup failure will end up being "using exceptions for flow control" (which is a well known 'bad'(TM) thing, right?) for callers specifically who will almost always want to/have to catch the (hopefully specific) exception and handle it. Or, to look at it another way it is using an exception for something which is not actually exceptional, which just seems wrong.

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to