
On Fri, Jun 21, 2002 at 06:59:23PM -0500, Glyph Lefkowitz wrote:
From: Tommi Virtanen <tv@twistedmatrix.com> Subject: Re: [Twisted-Python] Proposal: changes to reactor.clientTCP Date: 21 Jun 2002 22:04:08 +0300
But please do _not_ loose any information in the translation. Say people shouldn't look at the error objects errno attribute to decide what to do, as not all platforms provide it. But don't hide the actual error.
Upon consideration I strongly agree that no information should be lost.
So, let's have such a high-level error, and a .platformError attribute on the connection error object which is an object specific to the "OS" that you're running under. On POSIX this will be (or contain) an errno error code, but on Jython and elsewhere it will be whatever's appropriate. Does that work for you?
I don't care about the errno, but I do think that the corresponding error string (e.g. 'No route to host') should be available, so that you have something meaningful to display to the user, write in error logs, etc. Is it guaranteed that a socket.error's .args attribute will always be a 2-tuple of (errno, description) on all platforms? If so, I think that would make sense as the .platformError. -Andrew.