Re: Re: Throwable::addSuppressed()

From: Date: Sat, 01 Aug 2015 09:37:37 +0000
Subject: Re: Re: Throwable::addSuppressed()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-87482@lists.php.net to get a copy of this message
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

« previous php.internals (#87482) next »