Re: Exception not being caught

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 16, 2009 at 7:42 AM, David
Otton<phpmail@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> If it's catchable, why isn't it caught in my example?
>
> It's not an exception, it's a "fatal error". Fatal errors are caught
> by error handling functions, not by catch blocks.
>
> Consequence of having (at least) two separate error handling
> mechanisms in the same language.

That's definitely confusing, but more confusing to me is labeling the
fatal error as "catchable", which definitely implies a try / catch
block should handle it.

Maybe they should call it a "handleable" fatal error :) ... implying
it can be managed with set_error_handler().

On Thu, Jul 16, 2009 at 9:38 AM, Martin Scotta<martinscotta@xxxxxxxxx> wrote:
...
> http://ar.php.net/manual/es/function.set-error-handler.php
...
> You can write a simple handler or a fully featured one, but the essence is
> the same...
>
> function errorHandler(/*args*/)
> {
>     $e = new Exception( $message, $code );
>     throw $e;
> }

This looks like a great idea -- I was thinking I'd have to give up the
convenient flow control involved in exception handling, but this
should bring it back nicely.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux