Thoughts on try-catch blocks

Posted by John Boker on Stack Overflow See other posts from Stack Overflow or by John Boker
Published on 2009-04-15T13:41:35Z Indexed on 2010/04/04 8:43 UTC
Read the original article Hit count: 267

What are your thoughts on code that looks like this:

public void doSomething()
{
    try
    {
       // actual code goes here
    }
    catch (Exception ex)
    {
        throw;
    }
}

The problem I see is the actual error is not handled, just throwing the exception in a different place. I find it more difficult to debug because i don't get a line number where the actual problem is.

So my question is why would this be good?

---- EDIT ----

From the answers it looks like most people are saying it's pointless to do this with no custom or specific exceptions being caught. That's what i wanted comments on, when no specific exception is being caught. I can see the point of actually doing something with a caught exception, just not the way this code is.

© Stack Overflow or respective owner

Related posts about c#

Related posts about try-catch