Im doing this in c#. These are the code layers
VIEW -> VIEWHANDLER -> BusinessLayer -> WCF SERVICE
The view calls the ViewHandler which calls the business layer which calls the service. The service will throw some fault exception. All exceptions are handled in the View handler. The business layer re-throws the fault exception it got from the service as is to be handled in the VIEWHANDLER. What is the best way to rethrow it in the BusinessLayer?
catch(FaultException f)
{
throw f;
}
or
catch(FaultException f)
{
throw;
}
Does “throw f” resets the call stack information held in the caught exception? and does throw send it as-is?
Yes,
throw f;will reset the stack.throw;will not.In either case, if this is all you are doing in the
catchblock, you are better off not using atry-catchblock at all as it is pointless.