Re: Standardized way of interpolating variables into PEAR_Exceptionmessages?

From: Date: Mon, 25 Sep 2006 14:00:06 +0000
Subject: Re: Standardized way of interpolating variables into PEAR_Exceptionmessages?
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44053@lists.php.net to get a copy of this message
Alexey Borzov wrote: > Hi, > > Greg Beaver wrote: > >>> Trivial conversion can be done via >>> throw new Foo_Exception($error->getMessage()); >>> or the equivalent for PEAR_ErrorStack. As for automatic conversion >> >> >> Hi, >> >> As a side note, even this is unnecessary, as of PEAR 1.5.0, >> PEAR_Exception will be able to directly accept either a PEAR_Error > > > BTW, I don't think it is a good idea to use PEAR::isError() there: > > http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Exception.php?r1=1.23&r2=1.24 > since PEAR class can be undefined. What about > if (class_exists('pear_error', false) && $message instanceof PEAR_Error) > ? Hi, This sounds very good to me, thanks for the catch. Greg

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