Re: How to use Exceptions with MDB2

From: Date: Fri, 01 Jun 2007 16:07:24 +0000
Subject: Re: How to use Exceptions with MDB2
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27384@lists.php.net to get a copy of this message
On 6/1/07, Bjoern Fischer <fischbjoernchen@googlemail.com> wrote:
Hello! Many methods of MDB2 return a PEAR_Error object. Is it possible to throw an exception instead?
You can write your own PEAR error handler which throws exceptions but I do not suggest this. MDB2 is a PHP4 package which assumes that error handling is done in a PHP4 way. It is possible that if you throw exceptions that some internal logic in MDB2 would be incorrectly skipped when an error happens.
I've tried to do PEAR::setExceptionHandling(PEAR_ERROR_EXCEPTION) but the exception that is thrown is't handled and I get the warning "PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception" Thanks, Bjoern -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin

« previous php.pear.general (#27384) next »