Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62099 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94192 invoked from network); 9 Aug 2012 08:43:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Aug 2012 08:43:43 -0000 Authentication-Results: pb1.pair.com header.from=lang@b1-systems.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lang@b1-systems.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain b1-systems.de from 217.11.58.35 cause and error) X-PHP-List-Original-Sender: lang@b1-systems.de X-Host-Fingerprint: 217.11.58.35 mx1.b1-systems.de Linux 2.6 Received: from [217.11.58.35] ([217.11.58.35:59644] helo=mx1.b1-systems.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/05-00812-E3873205 for ; Thu, 09 Aug 2012 04:43:42 -0400 Received: from RLT400ETH.fritz.box (unknown [155.56.40.90]) by mx1.b1-systems.de (Postfix) with ESMTPSA id CFB254075 for ; Thu, 9 Aug 2012 10:43:38 +0200 (CEST) Message-ID: <5023783A.2070502@b1-systems.de> Date: Thu, 09 Aug 2012 10:43:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: internals@lists.php.net References: <501F46BE.4040407@sugarcrm.com> <50200FBD.2010506@sugarcrm.com> <5023544B.3020003@sugarcrm.com> <5D51773C7D9C4328908EF141AE4FA7E7@pc> In-Reply-To: <5D51773C7D9C4328908EF141AE4FA7E7@pc> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Error handling brainstorming From: lang@b1-systems.de (Ralf Lang) > I know PHP's model is all messed up, but no one here, I believe, is > asking about putting non-error log messages in Exceptions. IO failure is > an exception. > > If your IO operation fails, you can't just log it and plow forward > blissfully without handling the problem. > > Stan > Exceptions allow you to decide: I know how to handle it -> deal with it, I don't know how to handle it -> pop up to higher layer who might know I didn't know this case needs to be handled -> pop up to handler of last resort, either crash or catch-all and at least present some meaningful info on what happened. That's managable. Of course you can probably do most stuff with error code handling, PEAR_Error & Friends, error handlers for really bad stuff. We've been doing this before Exceptions. But wherever it makes sense, I tend to use them.