On April 12, 2004 10:58 am, Adam Maccabee Trachtenberg wrote:
> Still, you shouldn't be ignoring E_WARNINGs unless you have a good
> reason.

There are plenty of situations where E_WARNING can be safely ignored. And even 
more situations where E_NOTICE/E_STRICT can be ignored.

> Your code cannot correctly retrieve those rows from the 
> database when you've ignored the error telling you that there was a
> problem connecting to the database. :)

You may not want to retrieve the rows in the 1st place.

> Handling UNIQUEness queries is exactly the type of problem you're
> going to need to trap. For example:

Your example is not entirely correct. You'd first need to use 
$db->lastError() to the error code, $e->getCode() will return something else 
all together. However the bottom line is that now your exception handling 
mechanism is far more complex then it should/could be. If your block has a 
query() method with a query that can fail you'd need to add special 
conditions to handle it in the end you end up with an overly complex handling 
mechanism.
If you start putting an try {} catch {} block around every individual query 
method as an alternative, then you kill the whole point of exceptions, no?

Ilia

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to