Re: exceptions
| From: | Justin Patrin | Date: | Tue, 08 Jun 2004 22:02:10 +0000 |
| Subject: | Re: exceptions | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30231@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
Greg Beaver wrote:I assume you haven't read all of the other posts saying that we can't force exceptions or errors. Exceptions are one way of handling things and returning errors is another. "Exceptions are only supposed to be used for exceptional circumstances." Whether or not you believe that, using exceptions or returning errors is a design question and we don't want to force developers to use one or the other. Read the rest of the thread for more discussion. -- paperCrane <Justin Patrin>Justin Patrin wrote:Can't we just get rid of PEAR_Error and use exceptions instead ? Bertrand Mansion MamasamPEAR_Error extends Exception The PEAR_Error could be thrown *as it is* without having to convert between it and some PEAR_Exception. If this is impossible (or hard to do) please tell me. I haven't done any exception handling in PHP yet as I am forced to stick with stable (and mature) versions of PHP for my work.PEAR_Error already extends PEAR. Incidentally, these questions you are raising are all very good, and have been raised before on the list. PEAR_Error is in fact obsolete. Its primary features have been superseded by far superior exceptions and PEAR_ErrorStack. PEAR_ErrorStack can handle PEAR_Errors and convert them into any format you desire, including exceptions, so it acts as a bridge between old code and new code. Others are welcome to continue using PEAR_Error as is, but it will not be further bloated with new features/hacks.