Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92721 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16004 invoked from network); 25 Apr 2016 09:51:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2016 09:51:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:38578] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/23-00233-2A8ED175 for ; Mon, 25 Apr 2016 05:51:31 -0400 Received: by mail-wm0-f54.google.com with SMTP id u206so118001135wme.1 for ; Mon, 25 Apr 2016 02:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Ep8ffbwCGs0U63MM7/HCqjfBBYgQphPSkmmjTTmfS0E=; b=i0/tX01VpmBem4vfSG3PYnu2FXpTn0ZD0Hd/AirdgPB3dtXkuzt8+m0YfeGPPiM4hA uHM48zfUouFj5twzeVxbAWej7MWI9hszDVYq5hnasz803OPgZa/NQpGDQSA8vNWkusUp i9Uk5Q5nqeU/VehILcepy10VMR/qgu3MHztB6G/8W/gw+DyiPXAzk+ySts4pNi9k7NNr zklO4aS2vwUq6HvJd830EMNABBVvdFRMjQYSg/S62mgIE/MVxTccAVrzWlxbuW9J/amt llsb0j5B8EPMGnoDFqyLQxmo8CAO58Z6ZvMaX28yrUbCL88l4OK0IzJNLMl58OmnMU8G 2mNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Ep8ffbwCGs0U63MM7/HCqjfBBYgQphPSkmmjTTmfS0E=; b=J6A7uOYVU0s/UdES5Np+NN/29ONkq3W8zbN9can1YrhE/5C4POXCETifQMlTQ+u1Zj 1f0nLDIImR4Awp/AuaNG/1dtyQcuRT/MBS6JXjYkaTxmSayBjOFabRZqXdCOYIcFMSxc wPOVhbki9BSaHD81B631XWz46lepFDkhDpfuLSEn9iDp8WgHJqnYeERB0wgraItkOHUS WHQm5wXMY6rdtt0zV4fzMgzPE9Yt7phyGbkIIB0LYnQcGjT8KKsqFB7ZT6WlOfzb+j1G AUKA8/WF2VJDHwOg3xztrNQP2FZYebNGoUAaPqzkv1ifb7YDt3fazGqnlIfSPjOZ3Swj z9uQ== X-Gm-Message-State: AOPr4FUOnchWIKjlWgFW+WwTY+xwLk32h1lj0oZCTcoZ4SWHRa7q/Ad52I201WLHYN3CEw== X-Received: by 10.194.157.195 with SMTP id wo3mr33649291wjb.155.1461577888050; Mon, 25 Apr 2016 02:51:28 -0700 (PDT) Received: from [192.168.0.82] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id r123sm17888842wmg.20.2016.04.25.02.51.26 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Apr 2016 02:51:27 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <571DE825.6050807@gmail.com> Date: Mon, 25 Apr 2016 10:49:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] Catching Multiple Exception Types From: rowan.collins@gmail.com (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, -- Rowan Collins [IMSoP]