Re: Interest of PEAR::setErrorHandling?

From: Date: Mon, 30 May 2005 13:52:51 +0000
Subject: Re: Interest of PEAR::setErrorHandling?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-37891@lists.php.net to get a copy of this message
Vincent Lascaux wrote:
Let me give an example when this may happen: I'm the leader of File_Archive and I'm writing a function that allows appending to an existing archive, or creating an archive if it doesn't already exist. The first thing I do is to call a function that allows appending to an existing archive. If the archive doesn't exist, a PEAR error is raised, and I create the archive. 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 a proper use of setErrorHandling?
if you want to do this you should use expectError() or pushErrorHandling() .. this overrides any global error handler. once you no longer expect an error you pop the error handler. look at how DB/MDB/MDB2 implement the ondemand sequence generation for reference. Also there is a good article on pear error handling here: http://php-mag.net/itr/online_artikel/psecom,id,330,nodeid,114.html regards, Lukas

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