Re: question about PEAR Error
| From: | Jeroen Houben | 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) {Returning a new Pear_error object is not affected by static calls to PEAR::setErrorhandler and PEAR::expectError etc.. Cheers Jeroenreturn 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).