new push/pop error handlings
| From: | Tomas V.V.Cox | Date: | Fri, 27 Jul 2001 13:13:44 +0000 |
| Subject: | new push/pop error handlings | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-1090@lists.php.net to get a copy of this message | ||
Hi,
Based on the recent discussion (started at "Try and Catch") I made the
patch for supporting this cool new feature. The new concept "error
handler stack" will give more flexibility to the actual error handler
system, as it adds the ability to disable for some time the actual error
handler and restore it when finish.
For example:
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'my_func_handler');
$db = DB::connect($dsn);
PEAR::pushErrorHandling(PEAR_ERROR_PRINT);
$db->query("..");
PEAR::popErrorHandling();
or per class usage:
$db = DB::connect($dsn);
$db->pushErrorHandling(PEAR_ERROR_PRINT);
$db->query("..");
$db->popErrorHandling();
You could also forget the use of setErrorHandling and use only the stack
system:
PEAR::pushErrorHandling(PEAR_ERROR_DIE);
$db = DB::connect($dsn);
$db->query("..");
The patch is attached (or at least should be :) for testers.
Tomas V.V.Cox