Code Snippet With Syntaxhighlighter Support for Windows Live Writer
I found the PreCode AddIn for Windows Live Writer from Scott’s Blog.
So to celebrate ;) here is another WTF:
try
{
// Some Code
}
catch (WebException we)
{
throw (we);
}
catch (Exception e)
{
throw (e);
}
finally
{
}
What is the point of catching these Exceptions? Nothing! You also loose all the StackTrace when an error does exist. O yea and the finally block is totally superficial.
There are rules when dealing with Exceptions:
- Only catch exceptions if you can deal with them (Log it, gracefully exit, etc…).
- If you want to add additional value to the exception, create your own with the new information and use the caught exception as an inner exception.
- If for what ever reason you need to re-throw, then use “throw;” not “throw e;”.
I’m sure there is more, but for me these are probably the most important.