I'm just starting to use the Enterprise Library Exception Handling block.
It seems a little cumbersome.
Do I really have to do
try
{
//Do something with a DirectoryInfo object
}
catch(DirectoryNotFoundException ex)
{
bool rethrow = ExceptionPolicy.Handle(ex, _exceptionPolicyName);
if(rethrow)
throw;
}
Everywhere I want to handle exceptions?
Or should I just wrap the top level in
try
{
//Entrypoint code
}
catch(Exception ex)
{
bool rethrow = ExceptionPolicy.Handle(ex, _exceptionPolicyName);
if(rethrow)
throw;
}
I was under the impression I could aspect this on with attributes?