Pear/PHP Error Handling
| From: | H.W. Heinen | Date: | Wed, 12 Mar 2003 16:59:45 +0000 |
| Subject: | Pear/PHP Error Handling | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4186@lists.php.net to get a copy of this message | ||
Hi guys,
I've got a problem with handling of PEAR error in conjunction with normal PHP errors (E_WARNINGS etc.)
I'm fairly new to PEAR errorhandling but have quite some experience with PHP error handling...
here's the situation:
1. my own defined errorhandler for PHP errors
set_error_handler("errorHandler");
2. callback function for PEAR errors
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "pearErrors");
Let's say we connect to a postgress database which failes.
This gives me two problems:
1. PEAR generates an error that is displayed by the 'pearError' function. But after this, the original message is still printed and after that the script dies. I want to handle the error completely in the 'pearError' function and decide for my own if the script needs to die.
2. Apart from the PEAR error, the function pg_connect also raises E_WARNING indicating that the connection has failed. My own errorhandler function prints the error but it seems to happen simultaneously to the printing of the error in 'pearErrors' which screws up the output buffer.
Has anyone has a good system for this that enables me to fully control all errors and die decisions?
I can't set the PEAR errorHandling to PEAR_ERROR_TRIGGER because I want different actions for different error types (e.g. I find a 'no result' error different than a 'no connection' error).
--
: ing. Hermen Heinen :: hermen@4worx.nl
:____________________________________________________________________
:
: 4worx software innovators
: Marnixlaan 174
: 3552 HJ Utrecht
: The Netherlands
: www : www.4worx.nl
: email: info@4worx.nl
:____________________________________________________________________