Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73186 invoked from network); 6 Aug 2012 18:41:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2012 18:41:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.173 smtp173.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.173] ([67.192.241.173:41698] helo=smtp173.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/83-03102-1CF00205 for ; Mon, 06 Aug 2012 14:41:05 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp17.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id A3AD7188489; Mon, 6 Aug 2012 14:41:02 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp17.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 438E318849C; Mon, 6 Aug 2012 14:41:02 -0400 (EDT) Message-ID: <50200FBD.2010506@sugarcrm.com> Date: Mon, 06 Aug 2012 11:41:01 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Levi Morrison CC: Ferenc Kovacs , PHP Internals References: <501F46BE.4040407@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Error handling brainstorming From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Because checking that the returned variable is `!== FALSE` is *way* > better than throwing an exception, right? Yes, it is. You can control it, unlike the exception which you can not, unless, again, you wrap everything into try/catch on every kind of exception possible. > This type of thing is one of the main reasons I like PDO more than > MySQLi. In MySQLi I'm constantly checking return values. In PDO I > just wrap it all up one try/catch. It's not like if my query fails > I'm going to try a different one. Most of the time it's just logging > that something went wrong and reporting it upstream somehow. You are using exceptions for normal flow control. It is not what exceptions should be used for. They are called exceptions for a reason. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227