Re: phpbuilder - Error Handling
| From: | Ulf Wendel | Date: | Tue, 18 Jul 2000 21:33:29 +0000 |
| Subject: | Re: phpbuilder - Error Handling | ||
| References: | 1 2 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-147@lists.php.net to get a copy of this message | ||
Sterling Hughes wrote:
> >
> > > Ulf Wendel wrote:
> > How do I "catch" an error?
> >
> > $ok = DB::connect();
> > if ( is_object($ok) && "Exception" == substr(get_classname($ok), ??end
> > of beginning?? ) ) {
> > $msg = $ok->getLocalizedMessage();
> > # $ok->printLocalizedMessage();
> > }
> >
>
> Easier yet, have DB:: (or whatever class) provide a method that checks
> whether or not it is an error object (we have something like that now):
>
> $ok = DB::connect(..);
> if (DB::isError ($ok)) {
> /* .. */
> }
Forgot that and I buy that. isError() could do the above (or a similar)
if statement. You're voting for the way to use an error object instead
of integer constants, don't you?
Ulf