Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92977 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3588 invoked from network); 30 Apr 2016 10:17:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2016 10:17:50 -0000 Authentication-Results: pb1.pair.com header.from=bjorn.x.larsson@telia.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=bjorn.x.larsson@telia.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain telia.com from 81.236.60.155 cause and error) X-PHP-List-Original-Sender: bjorn.x.larsson@telia.com X-Host-Fingerprint: 81.236.60.155 v-smtpout2.han.skanova.net Received: from [81.236.60.155] ([81.236.60.155:36194] helo=v-smtpout2.han.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/56-58459-B4684275 for ; Sat, 30 Apr 2016 06:17:49 -0400 Received: from [192.168.7.7] ([195.198.188.252]) by cmsmtp with SMTP id wRy4aVua2qtwZwRy4aN97A; Sat, 30 Apr 2016 12:17:44 +0200 To: Rowan Collins References: <571DE825.6050807@gmail.com> Cc: PHP internals Message-ID: <5724864F.1000301@telia.com> Date: Sat, 30 Apr 2016 12:17:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <571DE825.6050807@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfE6lbGt8gnsibygEh+2thvrsnpyhAiB1b7DIVEN9yZiTc9wLO7gvMOuHZzHSrUIS/7vOg8nGHJ/y6hkgVaam0agdI2WztuRpj/G4GV4d46lw+0tgCjig CgaTm9BREoVyLHnwRsUrNUcj8qsB6jqUhHbxfOTmxUzKQj3USXrO8hBMz7bKoRL09dFtqAManUFlinB/WxM4oCjWzOKxkbf7WbWRg3oeImGO2TK6//+uF5IK Subject: Re: [PHP-DEV] [VOTE] Catching Multiple Exception Types From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2016-04-25 kl. 11:49, skrev Rowan Collins: > Patrick ALLAERT wrote on 24/04/2016 14:18: >> There is just nothing more repeatable or common cases than "resource not >> found", "method not allowed", "access denied",... They are all non >> exceptional cases better handled without exceptions and with clean APIs >> reflecting the business logic of the application. > > I think part of the problem may be that non-trivial examples require > rather a lot of context. An example that comes to my mind is if an > application is combining a bunch of different libraries, and calling > them all in sequence: > > try > { > $fooService->doStuff($data); > $barService->doMoreStuff($data); > $bazService->doDifferentStuff($data); > } > catch ( FooException | BarException | BazException $e ) > { > // We don't care which library threw the exception, the action is > always the same > throw new AppException($e); // Hide which libraries we're using to > implement the function > } > > Regards, Good example, thats how I would use multi-catch. Regards //Björn Larsson