DB error reporting and DB/ifx.php
[email protected] ("Tomas V.V.Cox") Wed, 28 Feb 2001 02:59:00 +0100
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
Hi ppl,
I started to build an informix class for Pear, and I find one little
problem perhaps discussed here time ago: What message should I return as
an error.
I think that native errors (when exists) should always be returned. They
contains more info about the error than a simple "no table".
I can think something like:
// an especific database method
function getNativeError (){
return '<br><b>'.ifx_error().'</b> '.ifx_errormsg();
}
And always filling the "native" param in raiseError(), with the returned
value of getNativeError(). Of course you need to use getDebugInfo() from
Pear_Error to see the error.
In my program I can do something like:
$debug=1; // enviroment setting, comment for production
$errorMsg = (isset($debug)) ? 'getMessage' : 'getDebugInfo';
$con = DB::connect('ifx://blablabla');
if (DB::isError($con)){
echo $con->$errorMsg();
}
Do you think it is a good practise? What other methods do you use for
error reporting while programing with pear?
Yet, the last question :), what should I do when I finish the class?
Thanks,
Tomas V.V.Cox
PD.- If you reply, please reply also to my email.