Reputation: 14736
What exceptions can be thrown from a WCF client?
I usually catch CommunicationFaultedException
, CommunicationException
, TimoutException
and some other but from time to time new ones occur, e.g. most recently QuotaExceededException
There is no common base to catch (except Exception) so does anyone have a complete list?
Upvotes: 0
Views: 883
Reputation: 755207
The CommunicationException
is the base exception for all WCF exceptions. If you catch that, you catch everything WCF related.
See the MSDN docs for CommunicationException. It will also nicely show a list of all derived classes, e.g. all more specific exceptions that can occur in WCF - quite a long list!
Upvotes: 0
Reputation: 9986
Just thinking outloud... one solution could be:
CException
.As soon as you catch an exception in your Exception
block, throw another exception into your CException
class. For instance like following:
catch(Exception ex){throw new CException("An error occured", ex);}
See this example.
Upvotes: 0
Reputation: 161821
Why would there be a complete list? This isn't Java.
Why do you want to catch an exception you don't understand? How would you "handle" it if you don't know what it means?
Go ahead and catch exceptions to log them, if you like, but you should rethrow after you catch it. Let the exception propagate up to some code that knows what to do with it.
Upvotes: 1