Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14601 invoked from network); 11 May 2003 14:23:40 -0000 Received: from unknown (HELO jdi.jdimedia.nl) (212.204.192.51) by pb1.pair.com with SMTP; 11 May 2003 14:23:40 -0000 Received: from jdi.jdimedia.nl (jdi.jdimedia.nl [212.204.192.51]) by jdi.jdimedia.nl (8.12.4/8.12.4) with ESMTP id h4BENdC6013836; Sun, 11 May 2003 16:23:39 +0200 Date: Sun, 11 May 2003 16:23:39 +0200 (CEST) X-X-Sender: derick@jdi.jdimedia.nl To: Sterling Hughes cc: marcus.boerger@post.rwth-aachen.de, internals@lists.php.net In-Reply-To: <1052077704.11371.319.camel@hasele> Message-ID: References: <5.1.0.14.2.20030504021938.09452980@mailbox.rwth-aachen.de> <1052077704.11371.319.camel@hasele> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] exceptions instead of errors From: derick@php.net (Derick Rethans) On Sun, 4 May 2003, Sterling Hughes wrote: > Just a note that I'd really like to see this. One of the great things > about exceptions will be: > > try { > $m = mysql_connect("localhost", "user", "pass"); > $sth = mysql_query("select bar from foo", $m); > while ($row = mysql_fetch_array($sth)) { > echo $row[0]; > } > mysql_close($m); > } catch (exception $e) { > echo $e->getMessage(); > } > > This allows you to remove all the nasty if ($conn) could, and move your > error handling into a singular place. I *really* would like this for > internal functions. We could also make a new type of exception > "internalexception," which a user has to specifically catch. This way > unless you explictly specify that you want to catch an > internalexception, it will default to just outputting an error message. Sounds like a great idea to me! Derick -- "my other box is your windows PC" ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------