Re: [VOTE] Exceptions in the engine

From: Date: Mon, 18 May 2015 17:58:29 +0000
Subject: Re: [VOTE] Exceptions in the engine
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-86297@lists.php.net to get a copy of this message
Dan Ackroyd wrote on 18/05/2015 18:38:
On 18 May 2015 at 15:39, Levi Morrison <levim@php.net> wrote:
I wouldn't group TypeException in the same subtree as ParseException, for instance. One happens at compile time and the other at run time, which means the intent in what you catch is probably quite different.
TypeException is also different the other EngineExceptions, as it's an exception that people will want to throw from their own code instead of having a separate UserLandTypeException. Except for testing, people shouldn't be throwing ParseException or other EngineExceptions from their code.
Hm, I think we may be getting somewhere; it does seem plausible that some specific "catchable fatal errors" in PHP 5 should actually be converted to Exceptions rather than Errors/EngineExceptions. Indeed, some of them have closely-corresponding exception classes in SPL, such as InvalidArgumentException:
Exception thrown if an argument is not of the expected type.
Thus the problem is not in creating an Exception/Error distinction in the first place, but in not thinking about which cases belong on which side of the split. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#86297) next »