I throw a few soap exceptions in my web service successfully. I would like to catch the exceptions and access the string and ClientFaultCode that are called with the exception. Here is an example of one of my exceptions in the web service:
throw new SoapException("You lose the game.", SoapException.ClientFaultCode);
In my client, I try to run the method from the web service that may throw an exception, and I catch it. The problem is that my catch blocks don't do anything. See this example:
try
{
service.StartGame();
}
catch
{
// missing code goes here
}
How can I access the string and ClientFaultCode that are called with the thrown exception?