On 03/08/12 17:04, Ferenc Kovacs wrote:
Warnings are special, they aren't really errors as such. They
wouldn't become exceptions.
Also, why should an erroring function return a value?
from
"My experience shows it's best to have an error handler convert all
errors to catchable exceptions, with some error types (like E_STRICT,
E_ERROR etc.) to become instant fatal errors (can't be caught)."
I think he is talking about turning everything(E_NOTICE, E_WARNING,
etc.) into exceptions except a few, which can't be catched (why should
E_STRICT be uncatchable?! ).
Of course some can't be caught. The kind that can't are ones that can't
be for obvious reasons. Runtime errors, for instance.
Which brings up the issues that I mentioned before.
Getting the return of an erroring function isn't such a big issue, but
turning everything into exceptions would prevent getting any return
value from any function/operation which triggers anything,
I don't see how the return value is needed if it has errored. Warnings
are different, but they wouldn't become exceptions.
Personally I think that turning everything into exceptions is a bad
idea, and it would make stuff which possible currently impossible.
Examples, please? I think making more things into exceptions, and hence
catchable, makes more stuff possible (recovering from trying to use
non-existent functions, for example)
On the other hand, I think that we have many E_ERROR which could be
turned into E_RECOVERABLE_ERROR.
Which in turn could be turned into Exception by an userland error
handler if the php userland developer wishes it.
Why not just have them exceptions in the first place?
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
--
Andrew Faulds
http://ajf.me/