Re: My Experience with PHP5 Error Handling (and possible
| From: | Sergio Carvalho | Date: | Wed, 25 Aug 2004 09:06:37 +0000 |
| Subject: | Re: My Experience with PHP5 Error Handling (and possible | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32938@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
To me the issue really lies with when to use Exceptions and when not to use Exceptions and this is the point where I disagree with the RFC. Not being able to connect to a database seems like a good case for an Exception in my eyes. Getting a contraint violation on a query isnt. Because the query was send and the database send a reply. Where is the exceptional state that warrents forcing me to wrap a try/catch block to handle this "error" .. potentially even multiple catch blocks.The wording on the RFC was fine tuned to allow both cases. Its a matter of properly defining your method. It all depends on the method being able to finish what it documents as its objective. If the method is executeQuery, then the constraint violation will prevent if from executing the query, and it should throw an exception. If the method is sendQuery, it will be able to send the query, and return whatever the database responded, regardless of the query actually succeeding in databaseland. Cheers, Sérgio
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc