Hi,
I think this question has an easy answer but I can't seem to find
anything online that lists best practices for my problem.
I have a C# app that uses an exception handling tree similar to the
following.
Try
{
blah blah blah....
}
catch(Unauthori zedAccessExcept ion noAuth){}
catch(IndexOutO fRangeException ){}
catch(Exception Ex){}
finally{}
I want to log an event on my server if any of the following exceptions
are thrown. My server logging methog looks like this:
LoggingManager. LogServerEvent( Exception.Messa ge.ToString());
I can add this method to each catch clause and it alogs the event fine.
I'd like to optimize my code so that this logging method is only in one
place. It seems silly to put it in all the catch clauses. Basically, if
ANY exceptions was raised, log it.
Any suggestions?
Thanks
Eric