I am in situation where I need to find the best possible approach to do this,
try
{
// Service call.
}
catch (FaultException exception)
{
service.Abort();
throw new FaultException(Resources.UnexpectedErrorOccurredAtServer, exception);
}
Or
catch (FaultException exception)
{
service.Abort();
throw new Exception(Resources.UnexpectedErrorOccurredAtServer, exception);
}
// Caller.
Main()
{
try
{
serviceCaller()
}
catch(FaultException ex)
{
// Should we have this catch???
}
catch( Exception ex)
{
// Handle unexpected errors.
}
what will be the best approach to throw the expected exception to caller. If we throw FaultException caller main method should Handle it explicitly or general exception will work.