Re: Bug #69640 Unhandled EngineExceptions thrown from userland do not produce any output

From: Date: Sun, 17 May 2015 00:20:13 +0000
Subject: Re: Bug #69640 Unhandled EngineExceptions thrown from userland do not produce any output
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-86281@lists.php.net to get a copy of this message
On 15 May 2015 at 14:38, Xinchen Hui <laruence@gmail.com> wrote: > I'd prefer to > disallow initializing a engine exception from user land.. > like if you try to initialize a engine/type/parser exception, an E_ERROR of: > what do you think? Someone reminded me that TypeExceptions are almost certainly going to be re-used by users for the cases where PHP's type system isn't powerful enough to handle their use cases: function handleFooOrBar($instance) { if(!$instance instanceof Bar && !$lol instanceof Foo) { throw new TypeException('$instance must be either an instance of Bar or Foo'); } ... } Re-using the built-in TypeException for this would be the right thing to do and so it needs to be creatable in userland. cheers Dan

« previous php.internals (#86281) next »