On 19.10.2007, at 02:20, Larry Garfield wrote:
On Thursday 18 October 2007, Lukas Kahwe Smith wrote:
The possibility of changing the error mode at run-time makes it
quite
hard to read code. Since you always have to check the error mode of
the
object you're currently looking at. Therefore I think we should
avoid
adding more of these switches in future - especially on an per-
object
basis.
Well I agree that this can be problematic. In the case of PDO one
might be passing a PDO instance to various libraries, which may rely
on exceptions being thrown or not. Personally I would not mind not
throwing exceptions for anything but constructor errors (actually I
think even those should be avoided), but that switch in PDO seemed
like an acceptable balance.
regards,
Lukas
I've actually had issues in the past with PDO and non-exception
error-mode
handling. I had queries that were running fine but when I checked
the error
value it gave a non-OK value. (I forget what off hand.) As soon as I
switched to exceptions, it worked perfectly. I believe this was
under 5.2.1.
--
Well that sounds like a bug and not like a "feature" of exceptions.
Or are you implying that the added complexity of this switch makes it
harder to write bug free code. I do image that its a bit annoying to
have to write tests to cover all the error modes.
regards,
Lukas
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php