Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5765 invoked from network); 2 Aug 2015 10:28:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2015 10:28:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=markus@malkusch.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=markus@malkusch.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain malkusch.de designates 31.47.225.241 as permitted sender) X-PHP-List-Original-Sender: markus@malkusch.de X-Host-Fingerprint: 31.47.225.241 malkusch.de Received: from [31.47.225.241] ([31.47.225.241:60760] helo=malkusch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/D1-22986-8E0FDB55 for ; Sun, 02 Aug 2015 06:28:56 -0400 Received: from f052011062.adsl.alicedsl.de ([78.52.11.62] helo=[192.168.1.90]) by malkusch.de with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1ZLqVg-0005pn-OP; Sun, 02 Aug 2015 12:28:53 +0200 Message-ID: <55BDF0DD.10709@malkusch.de> Date: Sun, 02 Aug 2015 12:28:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Stephen Coakley , internals@lists.php.net References: <55BBD019.5030106@stephencoakley.com> <55BC201D.6010600@malkusch.de> <55BC9361.1080804@malkusch.de> <55BCA7EE.4030301@gmx.de> <55BCDB57.5060609@malkusch.de> <6F.20.56402.69CADB55@pb1.pair.com> <55BDD9E0.6090801@malkusch.de> <55BDDEEE.9000407@malkusch.de> In-Reply-To: <55BDDEEE.9000407@malkusch.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.0 X-Spam-Score-Int: -9 X-Spam-Level: - Subject: Re: [PHP-DEV] Re: Throwable::addSuppressed() From: markus@malkusch.de (Markus Malkusch) Markus Malkusch: > try { > throw new Exception("Exception 1"); > > } finally { > try { > > } finally { > throw new Exception("Exception 3"); > } > } > > In this case the only place for the suppressed exception 1 can be > exception 3. For consistency and simplicity I'd therefore suggest that a > Throwable has a list of supressed exceptions and a suppressed exception > is always added to the resulting exception of a finally block. Actually I my self was not really certain why adding it to the resulting exception is better than setting it to the first exception. So I'd like to present a further scenario which hopefully helps to decide for the better definition: try { throw new Exception("Exception 1"); } finally { try { throw new Exception("Exception 2"); } catch (Exception $e) { // Don't throw anything cause this is expected. } finally { throw new Exception("Exception 3"); } } So in this scenario again exception 3 will be the resulting exception. exception 2 is expected and caught. Regarding exception 1 consider these two definitions: 1) The supressed exception will be attached to the first raised exception. This would be exception 2 in this case. Exception 2 is handled and the information about exception 1 is lost. 2) The supressed exception is added to the resulting exception of the finally block. This would be exception 3 in this case. The information is still present. So therefore I would vote for definition two. But I am also curious on other opinions. Markus Malkusch