I have seen Exception Handling blocks that they were throw
ing the recently caught Exception
in the catch
block. Something like:
} catch ( Exception $e ) {
// Do some recovery here
callSomeFunction();
throw $e;
}
To me it doesn't make that much sense to throw
the exact same Exception
like this, but I'm not sure if I'm right or not. Maybe there are situations that that's the only option?
My question is what are the pros and cons of this approach and shouldn't it be totally avoided as much as possible?