Re: exceptions

From: Date: Wed, 09 Jun 2004 08:32:14 +0000
Subject: Re: exceptions
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30253@lists.php.net to get a copy of this message
Justin Patrin wrote: >Bertrand Mansion wrote: >> >> Can't we just get rid of PEAR_Error and use exceptions instead ? >> >> Bertrand Mansion >> Mamasam > >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. OK. Things to take into consideration are: - If you use PEAR_Error, you add an external dependency to your package whereas exceptions are bundled in PHP5. I have had some requests for a PEAR free HTML_QuickForm, so exceptions are interesting in this case. - Returning a PEAR_Error object is IMO heavier than throwing an exception because of all the overhead it adds. I would be interested to know how many people know about exceptions and use them in their code already and what for.

« previous php.pear.dev (#30253) next »