Re: Interest of PEAR::setErrorHandling?
| From: | Michael Wallner | Date: | Mon, 30 May 2005 13:24:58 +0000 |
| Subject: | Re: Interest of PEAR::setErrorHandling? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-37890@lists.php.net to get a copy of this message | ||
Hi Vincent Lascaux, you wrote:
> Am I allowed to do that? Can the user decide something went wrong in my code
> because PEAR::raiseError has been called? Can you give me an example of
> legitimate use of setErrorHandling?
This scenario looks like a candidate for pushErrorHandling()/popErrorHandling().
PEAR::setErrorHandling() would override globally/user set error handling.
Short example:
function add(...) {
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$error = $this->append(...);
PEAR::popErrorHandling();
if (PEAR::isError($error)) {
$this->create(...);
}
...
}
Maybe not 100% correct,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc