Re: Code Modifications Needed for Error Handling

From: Date: Tue, 31 Aug 2004 06:03:22 +0000
Subject: Re: Code Modifications Needed for Error Handling
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33094@lists.php.net to get a copy of this message
Hi, Davey wrote:
3) PEAR_Exception In the constructor, add a set_exception_handler() of a callback to a method in PEAR_Exception which will add errors to the global PEAR_ErrorStack. Again, this can be overriden ONLY by set_exception_handler, and MUST NOT be overriden by package developers in child classes. Now, what this means is, whether you use PEAR_Error or PEAR_Exception, assuming you don't try...catch your exceptions, all errors will end up on the PEAR_ErrorStack (great if you're mixing 4&5 code). However, if you do try...catch any exception, it will not go on the ErrorStack.
To put it bluntly: sounds like a load of BS to me. Here is what the actual doc for set_exception_handler() [1] states:
Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.
What's the use of adding the exception to the stack if the script terminates immediately after? Repeat after me: there is no compatibility mode. You either use exceptions *or* are PHP4 compatible. Fortunately the RFC is accepted and we'll use exceptions. [1] http://www.php.net/manual/en/function.set-exception-handler.php

« previous php.pear.dev (#33094) next »