error handling
| From: | Colin Viebrock | Date: | Tue, 30 Jan 2001 20:09:26 +0000 |
| Subject: | error handling | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1223@lists.php.net to get a copy of this message | ||
Okay, this may be confusing, so bear with me.
I have my own error class which is an extention of PEAR_Error.
All I need to pass my class is an error code, and the class handles all the
other
stuff. Namely, depending on the code, I want the error to either be a
notice,
a warning or a fatal error. So I have something like:
class myClass extends PEAR_Error {
...
function myClass($code) {
$mode = PEAR_ERROR_RETURN;
$level = E_USER_NOTICE;
if (in_array($code, $this->warn_errors)) {
$mode = PEAR_ERROR_TRIGGER;
$level = E_USER_WARNING;
} else if (in_array($code, $this->fatal_errors)) {
$mode = PEAR_ERROR_TRIGGER;
$level = E_USER_ERROR;
}
return $this->PEAR_Error ('Some error', $code, $mode, $level );
}
}
My problem is that warnings and fatal errors say:
<br>
<b>Fatal error</b>: Some error in <b>PEAR.php</b> on line
<b>206</b><br>
Is it beyond the scope of PEAR to actually report the *real* script name and
line number on which the error occured?
--
Colin Viebrock
Co-Founder, easyDNS Technologies
http://www.easyDNS.com/