Markus Malkusch:

> 2) You are loosing one stack trace

I'd like to revise that. I'd just learned that finally does indeed fit
here, as it would automatically glue exceptions:

try {
    throw new Exception("A");

} finally {
    throw new Exception("B");
}

This prints both exceptions:

    PHP Fatal error: Uncaught exception 'Exception' with message 'A' in
    /home/malkusch/tmp/test.php:4 Stack trace:

    #0 {main}

    Next exception 'Exception' with message 'B' in /home/malkusch>
    /tmp/test.php:7 Stack trace:

    #0 {main}

So B's previous became A. Well I'm surprised, as there's no causality
between them, but OTOH it's called Exception::getPrevious() without any
further semantics. So this might be acceptable.

Unfortunately this reduces the justification for
Throwable::addSupressed() only to catch blocks.

Markus Malkusch

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

Reply via email to