Re: Exceptions and Errors
| From: | Ilia Alshanetsky | Date: | Mon, 12 Apr 2004 12:55:00 +0000 |
| Subject: | Re: Exceptions and Errors | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9060@lists.php.net to get a copy of this message | ||
On April 12, 2004 06:45 am, Andi Gutmans wrote:
> I don't see a problem with OOP extensions throwing exceptions.
> Andi
There is 1 problem with this approach. Currently an uncaught exceptions
results in a fatal error (E_ERROR) meaning that if a particular method throws
an exceptions it MUST be caught otherwise the script will terminate. Having
to wrap some methods inside exceptions can be extremely frustrating since you
may want to allow those methods to fail. For example the query method in
SQLite can safely be allowed to fail in certain instances. In other instances
when you care about failures there may be a need to implement custom handlers
depending on the nature of the error. For example if a query fails due to a
uniqness constrait, an UPDATE query would be ran while in all other instances
an error would be logged etc...
Ilia