Re: Re: DB Exceptions - Sample Code

From: Date: Fri, 09 Jul 2004 02:44:33 +0000
Subject: Re: Re: DB Exceptions - Sample Code
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31771@lists.php.net to get a copy of this message
    }
    catch (DB_AlreadyExistsException $ex) {
This should really be DB_Exception_AlreadyExists This does raise an interesting question about how instantate it in code: ... oops something gone wrong.. require_once 'DB/Exception.php'; throw new DB_Exception_AlreadyExists('some message'); or this could be wrapped locally: $this->throwException('AlreadyExists', 'some message'); (assuming all DB_Exception_* are in DB/Exception.php) The inheritance tree would look like this? DB_Exception extends PEAR_Exception {} DB_Exception_AlreadyExists extends DB_Exception {} .... While I dont really like having lots of empty classes, it looks like the lesser of all evils :) Regards Alan
        echo "Duplicate user name (exception)\n";
    }
And this isn't a lot more convoluted or than regular return code handling. Cheers, Sérgio Carvalho
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

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