DB error reporting and DB/ifx.php

From: Date: Wed, 28 Feb 2001 01:59:00 +0000
Subject: DB error reporting and DB/ifx.php
Groups: php.pear 
Request: Send a blank email to php-pear+get-1504@lists.php.net to get a copy of this message
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.

« previous php.pear (#1504) next »