On 1/14/08, Mark Clements gmane@kennel17.co.uk wrote:
Note, that when exception is raised, $wgOut may not be initialized, so sometimes it's not possible to use it.
As mentioned ("so it uses $wgOut, if that's available")
Also, wfRunHooks may raise exceptions itself, so it's neccesary to use another mechanism instead of hooks.
As mentioned ("and the exception wasn't thrown while processing another exception (to avoid loops).")
I should point out that the exception handler already catches exceptions thrown from the outputHTML()/outputText() methods, and prints a minimalistic default error message in those cases (relying only on the __toString() method, which I guess is technically not safe either). Look at wfReportException().
Plus, if you're running any hooks at all, there's a risk that the hook will throw an exception; the added possibility that the default hook-handling code might throw one is unimportant. Who says it's more likely to than your duplicate code?