> Also, throwing new exception with previous is not the same as throwing
> the same exception twice.

Correct, but I've personally never thrown the same exception twice.
The only times I've thrown exceptions from catch blocks is to provide
a better exception or perhaps to abstract away something in the
implementation. For instance, if I hit a PDO exception in my data
access then I'll catch it somewhere higher in the structure and throw
a GatewayException instead. Likewise, if the data was coming from The
Cloud and I couldn't access it for some reason I'd throw the
GatewayException. This way when someone uses the gateway the
implementation doesn't leak. This is the only time I've thrown
exceptions in a catch block.

This is an interesting 'bug' or 'feature' or whatever you want to call
it. I wouldn't say the current way is wrong, but a naive approach
would have some interesting issues as well. More than anything I think
we just need to decide what we want the behavior to be a document the
resulting quirks.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to