Re: expect()/popExpect()

From: Date: Fri, 01 Oct 2004 17:51:42 +0000
Subject: Re: expect()/popExpect()
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33600@lists.php.net to get a copy of this message
Greg Beaver wrote:
Lukas Smith wrote:
Greg Beaver wrote:
Hmm .. but how if at all does that integrate with PEAR::setErrorHandling()?
PEAR_ErrorStack has no PEAR_Error integration beyond the ability to return a PEAR_Error. What this means, however, is that an error that is not pushed will not generate a PEAR_Error, so you can simulate expectError() through this mechanism, if you're using compatibility mode.
Ah ok .. slowly getting it So I push onto the ErrorStack and then ErrorStack can determine if to raise an Error, thereby triggering the error handler. Here is the piece of code inside MDB2 which I would have to modify. Could you give me some more hints how I would need to transform the code in question? $this->expectError(MDB2_ERROR_NOSUCHTABLE); $result =& $this->_doQuery($query); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
    // handle the expected error ..
} } regards, Lukas

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