On 19/05/2016 19:35, Rasmus Schultz wrote:
Technically, every throw is a new exception "flow" - even if you're > recycling the Exception instance, it's the throw statement that >
starts the unique stack unwind from the throw site; it's where the > action happens.

That's one interpretation, but it doesn't really hold up in all cases. Consider a catch statement that needs to filter more granularly than the class name; since you already mentioned PDO, I'll make an example with that:

catch ( PDOException $e ) {
    if ( substr($e->getCode(), 0, 2) === '08' ) {
        $this->reconnect();
    } else {
        throw $e;
    }
}

Of what value to a subsequent catch statement is the trace of that throw statement? And why does that "start a new exception flow", but if PDO threw different sub-classes, you could let one flow through unmodified by tightening the catch statement?

Regards,
--
Rowan Collins
[IMSoP]


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

Reply via email to