Re: Exceptions and Errors
| From: | Marcus Boerger | Date: | Tue, 13 Apr 2004 20:05:25 +0000 |
| Subject: | Re: Exceptions and Errors | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9115@lists.php.net to get a copy of this message | ||
Hello Derick,
Tuesday, April 13, 2004, 9:28:38 AM, you wrote:
> On Tue, 13 Apr 2004, Greg Beaver wrote:
>> I don't think that exceptions suck, but I agree that they are limited in
>> their usefulness, just as you describe in the first paragraph. The
>> majority of error conditions aren't severe enough to need them.
>> Unfortunately, many developers I have talked to about exceptions plans
>> to use them for just about every kind of error condition, and they
>> expect them to be useful as such.
> Then they are abusing exceptions big time. Throwing exceptions for
> E_ERROR conditions *might* be a good idea, but for anything lower than
> that: no way. This also means that extensions usually should not throw
> exceptions at all, as they are not supposed to throw E_ERRORs that abort
> scripts right away.
This brings us back to an old problem the severity levels are inconsistent.
And further more we decided some time back that E_ERRORs shouldn't be
converted to exceptions because of a few E_ERRORs that might not be
continuable. From my point of view we should do two things:
1) convert the non continuable E_ERRORs to a higher severity (if there are
any at all)
2) Use exceptions when a ctor needs to advertise its failure and in other
places where exceptions are really usefull.
Too much exception is a bad thing anyway.
--
Best regards,
Marcus mailto:helly@php.net