As part of fixing old legacy code (written ~5 years ago and being maintained ever since) I asked one of my programmers to search all try-catch clauses in the application and make sure log4net is logging them.
What I found was that people use try-catch a lot as part of their debugging procedure or "let's cover up our failures" and as part of the application logic. All of them are WRONG uses of the try-catch mechanism!
Some examples:
Example #1 - "LET'S PLAY CATCH!"
try
{
...
}
catch(Exception ex)
{
return null;
}
All I can say is - "If a tree falls in a forest with no one to hear it, then does it make a sound?"
Example #2 - "LET'S PLAY CATCH AND DRIVE THE CLR MAD!"
try
{
...
}
catch(Exception ex)
{
string sError = ex.Message;
}
This example demonstrates how to use try-catch for debug and keep the CLR busy!
Example #3 - "LET'S PLAY SMART CATCH!"
try
{
objPds.PageSize = Convert.ToInt32(Page.ResultsPerPage);
}
catch
{
objPds.PageSize = 100;
}
Trying to light a match on order to make sure the match is working?
A more detailed list of wrong actions and the right way of doing them will be published later on as we will proceed with the project.
It was the 74-133 which is also known as 'customizing portal solutions with Microsoft SharePoint products and technologies (Including Microsoft Content Management Server)'.
Now it's up to Meron to help me pass the MOSS 2007 exams ASAP...