Re: PEAR_Error class
| From: | cagrET | Date: | Mon, 26 May 2003 16:32:09 +0000 |
| Subject: | Re: PEAR_Error class | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16721@lists.php.net to get a copy of this message | ||
but i dont want making my DB_Error class independent from my Error class
(logging errors)
its another package ... but i want to implement in DB to be able to use this
Error class
hmm i thought about other solution
in my DB_Error constructor i will make smth like that
if (PEAR_ERROR_PRINT & $mode) {
printError();
$mode = $mode - PEAR_ERROR_PRINT;
}
elseif (PEAR_ERROR_DIE & $mode) {
printError();
$mode = $mode - PEAR_ERROR_DIE;
}
$this->PEAR_Error($msg, $code, $mode .......);
it looks k now - i can use my own print style - and it will not be printed
again in PEAR_Error
and i can have my own Error callback - to use with my Error class
--
why "myDB_Error" ? I will never use at the same time PEAR::DB and my own
class ...
so name can be the same i think :)
PS. and my DB class has 90% features of PEAR::DB but is only 25 KB of code
:]
anyway thanks,
--
cagrET
Uzytkownik "Alexander Merz" <alexander.merz@web.de> napisal w wiadomosci
news:3ED21135.2000402@web.de...
> cagrET wrote:
>
> > I have own DB class and DB_Error class which extends PEAR_Error
> sidenote: better name the error class myDB_Error or so, DB_Error is
> alreay the name of the Error class of the PEAR-DB class
>
> What about this solution:
> You have already a own error class, why not doing something like this:
>
> PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "errorfunc");
> .....
>
>
> function errorfunc($pe) {
> if('myDB_Error'==get_class($pe) {
> // error caused by your DB class
> } else {
> // handle errors of other classes throwing a
> PEAR error
> }
> }
>