Re: question about PEAR Error

From: Date: Thu, 23 Oct 2003 12:06:33 +0000
Subject: Re: question about PEAR Error
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8555@lists.php.net to get a copy of this message
Jeroen Houben wrote:
Hi, I was just wondering what the difference is between PEAR::raiseError() and returning a PEAR_Error object. Say for instance: function getName() { ....... if ($errors) {
      return new PEAR_Error('could not find name');
} else {
      return $name;
} } OR function getName() { ...... if ($errors) {
      PEAR::raiseError('could not find name');
} else {
      return $name;
} } Which one would be better? Are there cases in which one method is preferable? Worked it out myself (I think).
Returning a new Pear_error object is not affected by static calls to PEAR::setErrorhandler and PEAR::expectError etc.. Cheers Jeroen

« previous php.pear.general (#8555) next »