Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91584 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64564 invoked from network); 9 Mar 2016 13:03:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2016 13:03:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierrick@webstart.fr; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pierrick@webstart.fr; sender-id=unknown Received-SPF: error (pb1.pair.com: domain webstart.fr from 209.85.161.169 cause and error) X-PHP-List-Original-Sender: pierrick@webstart.fr X-Host-Fingerprint: 209.85.161.169 mail-yw0-f169.google.com Received: from [209.85.161.169] ([209.85.161.169:35295] helo=mail-yw0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/D1-53667-73F10E65 for ; Wed, 09 Mar 2016 08:03:52 -0500 Received: by mail-yw0-f169.google.com with SMTP id g127so38672352ywf.2 for ; Wed, 09 Mar 2016 05:03:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=webstart-fr.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=KhhKQ/1pfAPR4PX9hEmsr+DwUZqdsKKDTezWW5xfmVE=; b=C5lC5f+0i1WpMQBiuOqnfVn7PO1xt2HTwZpKpLn71QdoX+dDTcYgnF3/Zzm4eXesP8 tnaaQL8QHZDlQMBFoRQqVA/Z7Dv5+gwRrYsvK4WY5YSvV3AjE5ZZCHCdpBfWmktx4xkj Bj5Xd7szUFEBjIvpvkyMBG+Nw2i3lv5Dbn6d5ZSJSPfS36eE8Al9XtScnzvlxtEuX3xV xp/gTil8HpNL8BIPrd1ls99HrqTVZN5pM9XCbWUgv0igZKIw8Fd7xTVF86N8Wn+slxJ+ RZ3c4ut98EDfeECsvRj5EPsVsIalzetZvrYp1tjJs16mPewn4hE2SOuLx2WGZeE1Zjcb iDpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=KhhKQ/1pfAPR4PX9hEmsr+DwUZqdsKKDTezWW5xfmVE=; b=YcS/mdiNe6GZtCeGesPgOUmQdTZwHqxLLX+EyGo4bVxHy8AXD1cEqtdYbl1tVz2W+g /eWRktJ3I0RdhPxPuTPiosHaqv1H1QIvpq3AaaueVyjojNXgV+n6dHiwM2M7+0YHBTrd 2GU6SJVzQgFhVQdzyM0AMtODvxx6WQj6G/He8jR1ZKpoogM6J5RW0ohsars8VQYn64xG ui2DJVwU/HGZqvVjOJXwfFzWDoTbXDgOi73pt978pyjElOuu9y9HqsW7KdBhZzSDL1EC 90idn0A50k+SHRHMNQvEW8q44CLqDeICEseUk4QgVW2u8aljyWuDYiVwTcnE2VWaj+GM HIPQ== X-Gm-Message-State: AD7BkJIJrfOjaUOS3aLYOWYnYMSqyIAHPFqnH3PvCRklwz4ONCBeeZpzrEHNIwdV7brbSlt8uSHc9GPZeBjcmA== MIME-Version: 1.0 X-Received: by 10.129.110.197 with SMTP id j188mr18222281ywc.293.1457528628550; Wed, 09 Mar 2016 05:03:48 -0800 (PST) Sender: pierrick@webstart.fr Received: by 10.37.76.130 with HTTP; Wed, 9 Mar 2016 05:03:48 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Mar 2016 08:03:48 -0500 X-Google-Sender-Auth: VXrogDhSNF6QanosxD2AumNMfhg Message-ID: To: Derick Rethans Cc: PHP internals , =?UTF-8?B?QnJvbmlzxYJhdyBCaWHFgmVr?= Content-Type: multipart/alternative; boundary=001a1146c95a27e516052d9d5477 Subject: Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types From: pierrick@adoy.net (Pierrick Charron) --001a1146c95a27e516052d9d5477 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Derick I agree that most of the time the best solution is to implement a clean exception hierarchy but as stated in the RFC : "A solution to fix this problem on the user level would be to implement a common interface for ExceptionType1 and ExceptionType2 and catch it. However, this is only possible when you control the exception hierarchy in your own code, but not possible when you don't control the code." On 9 March 2016 at 06:52, Derick Rethans wrote: > Hi! > > On Tue, 8 Mar 2016, Pierrick Charron wrote: > > > Bronis=C5=82aw Bia=C5=82ek and I would like to start a discussion about= allowing > > multiple exception types to be caught in a single catch statement. > > > > https://wiki.php.net/rfc/multiple-catch > > Would it not be better, to have your Exceptions extend a common base > class in this case? Or perhaps, which I think is even better, to have > your Exception classes implement a common interface that you can catch > against. That I believe should already work. > > What you are asking PHP users to do with a multiple catch like this, is > to test in each catch's statement block to test for each class again. > Neither the inheritence or implements options from the previous > paragraph have that issue. > > cheers, > Derick --001a1146c95a27e516052d9d5477--