Exception Handle Policy File

Topics: Exception Handling Application Block
Oct 2, 2007 at 8:19 PM
Hello everyone,

I'm new to Ent Lib and had a quick question.

I have configured my ent lib data access to use a different config source file based on the examples provided in the documentation. I wanted to do the same with the exception handling and found there was no quick way to do the same. My question is why does the following code ref ExceptionPolicy class

private static bool HandleException(Exception exceptionToHandle, string policyName, ExceptionPolicyFactory policyFactory)
{
ExceptionPolicyImpl policy = GetExceptionPolicy(exceptionToHandle, policyName, policyFactory);
return policy.HandleException(exceptionToHandle);
}

have to be private. If this was public and with the following code:

Dim fileSource As FileConfigurationSource = New FileConfigurationSource("DataAccess.config")
Dim myExceptionPolicy As ExceptionPolicyFactory = New ExceptionPolicyFactory(fileSource)

Try

rethrow = ExceptionPolicy.HandleException(ex, policy, myExceptionPolicy)

I then have the ability needed. Is there any reason why this was private and not public.

Thanks
Sal
Oct 3, 2007 at 12:19 PM
Hi Sal,

It should have been public; the implementation is based on Brian Button's change described in http://www.agileprogrammer.com/oneagilecoder/archive/2006/02/20/11628.aspx.

Fernando
Oct 3, 2007 at 12:20 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.