Posts Tagged ‘Exceptions’

Finding Empty Exceptions in Your Code

// December 6th, 2008 // 1 Comment » // Programming

I’ve had this regular expression for a while, but thought I’d post it as it’s quite handy.

We’ve recently been looking for all the empty exceptions that are being caught in our code. An awful error to make in programming. If you catch an exception you should always handle it, even if it’s merely logging something.

Anyway to quickly find them in Visual Studio. Press Ctrl+Shift+F, and then use the following regex:

catch:Wh*\{:Wh*\}