@CDarklock said:
Are you on crack? Rethrowing the exception is EXACTLY the right thing to do. The end result of this code is the same as:[do some of the work]
[do some of the work]
[do some of the work]
[do the last of the work]
return result;As soon as an exception gets thrown, it propagates upward in the call stack to be handled elsewhere.
You've just said that the end result of the code is as though none of those try/catch blocks were present. What's the point, then? That's exactly the WTF.
In maintainable, production systems, you do not toss in code that has no purpose and no effect. It increases the size of the executable and adds more paths that need to be tested. A comment would be just as significant and you don't have to worry about it introducing a bug.
And here's a bonus WTF: since the code is littered with "worse" examples, couldn't you have chosen a worse one? Did you think we just couldn't handle a WTF that big? "Hey, I'll post one of these to TDWTF... but just a small one, I don't want people to get TOO much WTF out of it."
I said worse exception handling code, not worse WTFs. Surely even you can perceive the difference.