Why does ProvideFault catch my TimeoutExceptions?

248 views Asked by At

I've got a ProvideFault() service that communicates through wcf. For most exceptions, we want to catch them, convert them into a FaultException<CustomException>, and let the caller handler it, so we've implemented ProvideFault().

So far, so good, and it mostly works. But this service is calling another service, which sometimes throws a TimeoutExeption; we don't want to catch that exception, but instead let it bubble up to the caller (or even throw a new TimeoutException, if necessary). The problem is that when the method throws a TimeoutException, ProvideFault() tries to deal with it and turn it into a FaultException.

How do I force wcf to let it bubble up as a TimeoutException?

1

There are 1 answers

2
Shiraz Bhaiji On

WCF sends exceptions as FaultExceptions, so you cannot bubble up a Timeout Exception.

What you can do however is to send up a:

FaultException<TimeoutException>