Re: Code Modifications Needed for Error Handling
| From: | Davey | Date: | Tue, 31 Aug 2004 06:26:17 +0000 |
| Subject: | Re: Code Modifications Needed for Error Handling | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33095@lists.php.net to get a copy of this message | ||
Alexey Borzov wrote:
Hi, Davey wrote:How odd, I opened up my newsreader to report this exact thing. /me re-thinks There must be a solution to this problem, even if it means bugging a php-dev till they change how set_exception_handler() works ;)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.we'll get it yet, ye of little faith.
Fortunately the RFC is accepted and we'll use exceptions.Well, fuck you very much :P Thankfully no package that follows the RFC can be more than devel/alpha level if Greg's proposal goes ahead :D - Davey