Re: [RFC] Exceptions in the engine

From: Date: Sat, 26 Oct 2013 12:18:17 +0000
Subject: Re: [RFC] Exceptions in the engine
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-69875@lists.php.net to get a copy of this message
On 25/10/2013 20:41, Joe Watkins wrote:
If we really wanted to, we could fix all the code that throws the base Exception, making them throw specialized types, as they should
This seems a little contradictory when you're proposing an undifferentiated EngineException, where individual errors would need to be distinguished based on the message string. That's pretty much what throw Exception('Some message'); gives in userland. Besides which...
and include a compiler check that finds catch(Exception) blocks and complains, it shouldn't really be valid
I don't think "catch(Exception)" blocks exist as a partner to "throw Exception;" they exist to mark a boundary in code that you don't want any exceptions to cross, or where you want to log all exceptions in some bespoke way. They might be the last in a long string of catch() blocks attached to one try, like the default: label in a switch statement. They might also, as discussed wrt assertions/expectations, be in a unit testing framework. -- Rowan Collins [IMSoP]

« previous php.internals (#69875) next »