Re: Using PEAR_ErrorStack
| From: | Justin Patrin | Date: | Wed, 15 Mar 2006 17:29:08 +0000 |
| Subject: | Re: Using PEAR_ErrorStack | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-41800@lists.php.net to get a copy of this message | ||
On 3/15/06, Scott Mattocks <scott@crisscott.com> wrote:
> Hello,
>
> I am trying to understand how to use PEAR_ErrorStack so that I can
> update my proposal for PEAR_PackageUpdate but I am having some trouble.
> I need to capture errors from other packages and add them to the stack.
> For example, I have this in my code:
>
> // Check for errors.
> if (PEAR::isError($parsed)) {
> // Do something with the error...
> }
>
> How can I get that error on to the stack without making calls to
> getCode, getMessage, etc...?
>
> Also, is there a way to make other packages use my error stack? The
> above code comes from a call to a PEAR_Registry object. I would like to
> use PEAR::setErrorHandling() but there is no option for PEAR_ErrorStack.
> Using setErrorHandling(PEAR_ERROR_CALLBACK, array($myStack, 'push'))
> will not work because the call back must accept a PEAR_Error object.
>
What about:
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$this, 'pushError'));
--
Justin Patrin