Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95074 invoked from network); 2 Aug 2015 09:12:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2015 09:12:28 -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:60600] helo=malkusch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/01-22986-9FEDDB55 for ; Sun, 02 Aug 2015 05:12:28 -0400 Received: from x5ce10ad4.dyn.telefonica.de ([92.225.10.212] helo=[192.168.1.90]) by malkusch.de with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1ZLpJd-0005T0-Qf; Sun, 02 Aug 2015 11:12:22 +0200 Message-ID: <55BDDEEE.9000407@malkusch.de> Date: Sun, 02 Aug 2015 11:12:14 +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> In-Reply-To: <55BDD9E0.6090801@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: > The try-finally scenario involves only one supressed > exception. I'd like to see a possibility to add more supressed > exceptions Actually try-finally can already involve several supressed exceptions as well: try { throw new Exception("Exception 1"); } finally { try { throw new Exception("Exception 2"); } finally { throw new Exception("Exception 3"); } } So in this scenario I exception 3 will be the resulting exception and as already defined within your mail exception 2 should be its supressed exception. But what about exception 1? This could now be the supressed exception of exception 2 or added to the list of supressed exceptions of exception 3. I'd argue *adding* it to the resulting exception of the finally block makes the most sense. This would be exception 3 in this case and therefore needs to be a list. Why does this make more sense. I'd argue it's more expected and intuitive, as exception 2 is optional. Just consider a similar case without exception 2: 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. Markus Malkusch