Has the webservice client lost the connection?

How do you tell if an exception from a call to a webservice is caused by an IO error?

        public static bool IsIoException(Exception e)
        {
            return (e is TimeoutException || e is CommunicationException || e is EndpointNotFoundException) && !(e is FaultException);
        }

Easy, right?

FaultException is derived from CommunicationException, but it occours when the server sends a SOAP fault back, so definitely not a communication problem (at least between client and webservice). I’m not sure why an EndpointNotFoundException would be thrown because of not being able to talk with the host, but I’ve seen it happen after unplugging my ethernet cable…

So why exactly can’t I just have one sort of exception to catch? Am I not supposed to handle a lost connection in a graceful way?

Oww Microsoft thou art a heartless bitch…