Re: zippidity do duh!

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

 



On Wed, Jul 9, 2008 at 6:52 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:

> try triggering an E_FATAL instead of E_NOTICE and you'll see
> there is no need to use Exceptions in this case (albeit that
> it's an acceptable alternative).
>

minor but, it would have to be E_USER_ERROR, because you can only trigger
E_USER_* errors from trigger_error().  anyway, that will halt script
execution, unless there is a handler specified with set_error_handler(),
which i would consider undesirable.  it seems to me it would be better to
acknowledge the issue and move on to other things during the request
processing, which is why in this case, and with most trigger_error() cases,
i typically use E_USER_NOTICE, unless i really intend to have the script
execution terminated, or i know for sure there is an error handler in place.

the reason i recommended an exception is because tedd was making it sound
like he wanted to alter the flow of control.  well, in that case, you dont
need exceptions, the alternate logic could obviously be placed in the body
of the else block, along with, or instead of, the trigger_error() call.  as
well, this could be turned into a function which would return a boolean
value, or accept a callback, or make me breakfast...  yes, there are many
ways to skin the cat here :)

and no, i likely wouldnt use an exception here, unless this was part of a
class (which in my code it likely would be :D).

-nathan

[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