To your second example, the easier solution would be not to have a "general" catch block at all, right?
try
{
// code that may throw exception here
}
catch(SQLException sqlex)
{
//Handle this exception here
//Don't re-throw the exception.
//Other exceptions will remain uncaught.
}
On the other hand, the opposite really does require a rethrow:
try
{
// code that may throw exception here
}
catch(SQLException sqlex)
{
//We really want to rethrow just that exception for some reason.
throw;
}
catch
{
//Whereas for everything else, we want to handle the exception here...
}