Re: MDB - Error questions

From: Date: Fri, 14 Jun 2002 13:19:45 +0000
Subject: Re: MDB - Error questions
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7021@lists.php.net to get a copy of this message
On Thu, 2002-06-13 at 17:57, Brent Cook wrote: > Hi Lukas, > > In MDB.php > > function &factory($type) > { > @include_once("${type}.php"); > > $classname = "DB_${type}"; > > if (!class_exists($classname)) { > return PEAR::raiseError(NULL, DB_ERROR_NOT_FOUND, > NULL, NULL, NULL, 'DB_Error', TRUE); > } > > @$db =& new $classname; > > return $db; > } > > Should the class indicated in raiseError be MDB_Error? > > Also, what's the difference between doing this: > > return PEAR::raiseError(NULL, DB_ERROR_INVALID_DSN, NULL, NULL, 'no valid > DBMS driver include path specified', 'MDB_Error', TRUE); > > and this: > > return PEAR::raiseError('no valid DBMS driver include path specified', > NULL, DB_ERROR_INVALID_DSN, NULL, NULL, 'MDB_Error'); The first one has an extra parameter, called "skipmsg" which makes raiseError skip the error message when creating the error object. Instead, the error code becomes the first parameter. This feature is useful when you have abstracted error codes like [M]DB and want to base error handling on error codes rather than messages. - Stig -- Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway http://pear.php.net/wishlist.php/ssb

« previous php.pear.dev (#7021) next »