Re: Re: PEAR_Exception in CVS
| From: | Hans Lellelid | Date: | Mon, 21 Jun 2004 17:54:45 +0000 |
| Subject: | Re: Re: PEAR_Exception in CVS | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31042@lists.php.net to get a copy of this message | ||
Daniel Convissor wrote:
On Mon, Jun 21, 2004 at 07:29:57AM -0400, Hans Lellelid wrote:Yes, I think you must be. It is true that one of the things that Exceptions provide that was not [cleanly] possible using return values is the ability to handle errors in constructor. Also, in PHP5 you can no longer re-assign $this, which was always a hack anyway, so the current PEAR method of $this = PEAR::raiseError() won't work at all in PHP5. But in general, Exceptions provide a very flexible (superior!) error-handling approach that can (should!) be used for any & all errors (but not 'warnings' or 'notices'). Here's a good presentation on Exceptions in PHP5: http://www.andreashalter.ch/phpug/20040115/ Cheers, Hanstry { $con->execute("DELETE FROM ....."); } catch (SQLException $sqle) { throw new PropelException("Object delete failed", $sqle); }All of the planning discussions I've seen here and on internals@lists.php.net have indicated that exceptions should only be used for constructors that fail and fatal startup errors. Perhaps I'm mixing apples and organges.