Re: DB Exceptions - Sample Code

From: Date: Thu, 08 Jul 2004 21:05:35 +0000
Subject: Re: DB Exceptions - Sample Code
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31766@lists.php.net to get a copy of this message
Thanks for the sample code, Aurthur. It definitely helps make for grounded discussion. Arthur Hundiak wrote:
Lukas Smith wrote:
could you put up .phps files?
Done. http://www.cerad.org/pear/index.php
What I don't understand is how you can both have configurable error handling *and* use exceptions within your package. For example, I woudln't want to this:
if (DB::isError($result) || $result === DB_OK) {
    return $result;
} else {
    $tmp = new DB_result($this, $result);
    return $tmp;
}
Not in a PHP5 package when I had ability to use try/catch blocks. I think that exceptions are useful both within packages as well as between them. How do you allow a package to use exceptions internally but have the errors that leave the package be either exceptions or return-code? -- especially when many public methods are being called internally also. Hans

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