Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7812 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51082 invoked by uid 1010); 13 Feb 2004 17:47:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51005 invoked from network); 13 Feb 2004 17:47:39 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 13 Feb 2004 17:47:39 -0000 Received: (qmail 12219 invoked from network); 13 Feb 2004 17:47:35 -0000 Received: from guardian.zend.office (HELO andi-laptop.zend.com) (10.1.1.4) by int.zend.com with SMTP; 13 Feb 2004 17:47:35 -0000 Message-ID: <5.1.0.14.2.20040213194729.02b6f718@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 13 Feb 2004 19:47:31 +0200 To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_default_classes.c zend_default_classes.h zend_execute.h zend_execute_API.c From: andi@zend.com (Andi Gutmans) At 08:12 AM 2/13/2004 -0500, Sterling Hughes wrote: > > zeev Thu Feb 12 05:24:40 2004 EDT > > > > Modified files: > > /ZendEngine2 zend_default_classes.c zend_default_classes.h > > zend_execute.h zend_execute_API.c > > Log: > > Exceptions updates: > > > > - Enforce exceptions to be derived from class Exception. This allows > > users to perform catch-all. It's not yet complete, so don't get > > comfortable with it just yet :) Updates are coming soon. > >This is imho wrong. Exception is not a requirement, but an optional >thing. For the most part, all user exceptions should inherit from >"Exception," but that same onus is not on extension space exceptions, or >exceptions that are meant to be thrown out of bounds. > >Ie, you should be able to have: > >try { > foo(); >} catch (Exception $e) { >} catch (InternalException $ie) { >} > >What is the reasoning for this new change? The reasoning is that it allows users to do a catch-all (which otherwise we'd add to the language syntax). It also adds cleanliness to the Exception hierarchy and allows PHP code to interact with PHP code which isn't written by the developer knowing that there's a common interface (such as getMessage()) which the exception always adheres to. That improves the ability of exception handling especially debugging and logging significantly. i.e. try { ...// Main code which calls PEAR, SOAP, Smart, external stuff and so on.... } catch (Exception $e) { print "Damn something is really wrong here\n"; print $e->getMessage(); } Andi -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php