Re: Re: RFC::Error Handling Guidelines for PHP5 packages

From: Date: Tue, 24 Aug 2004 16:36:06 +0000
Subject: Re: Re: RFC::Error Handling Guidelines for PHP5 packages
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32895@lists.php.net to get a copy of this message
Sergio Carvalho wrote:
a prime example to me would be an error inside a query. there might be syntactical errors, contraint violations, missing entities etc. right now all of these are PEAR_Error's however I would say that atleast all but the syntax errors should not become Exceptions.
If I understand the case correctly, they're all errors. The query can't be run because of them.
Yes, exactly. As far as the execute() method is concerned, it failed. execute() doesn't know how to recover from a failed query since execute()'s only job is to execute a query. The calling application (e.g. DB_DataObject, or your own app) can determine the severity of the failur of a particular query. E.g. for Postgres I use "DROP TABLE $tablename" when I'm not always sure if the table exists. I simply surround that with a try/catch and ignore those errors since that is an acceptible failure. This is certainly the exception to the rule, though, as generally a query that fails to parse or execute is a big problem. -Hans

« previous php.pear.dev (#32895) next »