ExceptionPolicy.HandleException Method (Exception, String)

The main entry point into the Exception Handling Application Block. Handles the specified Exception object according to the given policyName.

Namespace: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Assembly: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling (in Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll) Version: 6.0.0.0 (6.0.1304.0)

public static bool HandleException(
	Exception exceptionToHandle,
	string policyName
)

Parameters

exceptionToHandle
Type: System.Exception
An Exception object.
policyName
Type: System.String
The name of the policy to handle.

Return Value

Type: Boolean
truetrue (True in Visual Basic) if rethrowing an exception is recommended; otherwise, falsefalse (False in Visual Basic).

The following code shows the usage of the exception handling framework.
try
{
    DoWork();
}
catch (Exception e)
{
    if (ExceptionPolicy.HandleException(e, name)) throw;
}
Show: