Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
This would make possible adding a logger object as a listener. There are cases in ZF where an exception is caught and replaced by throwing another one, which is more general. The details and the origin of the error are lost then. It would be nice to be able to log all exceptions in the execution flow, I think. I agree. I have had to comment out higher-level exceptions to figure out what goes on at a lower level. There needs to be an exception stack just like in Java. Christoph
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
Hi Christoph, hi Peter, Am Mittwoch, den 23.07.2008, 12:26 -0600 schrieb Christoph Dorn: [...] I agree. I have had to comment out higher-level exceptions to figure out what goes on at a lower level. There needs to be an exception stack just like in Java. In 5.3 you can pass the previous exception to the current as the third parameter. The previous exception can than later be retrieved with $exception-getPrevious(). Take a look: http://lars.schokokeks.org/php/exception-previous.phps cu, Lars signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
Am Mittwoch, den 23.07.2008, 20:43 +0200 schrieb Lars Strojny: In 5.3 you can pass the previous exception to the current as the third parameter. The previous exception can than later be retrieved with $exception-getPrevious(). Sorry, sent too early. What I wanted to add was: this could be easily implemented for compatibility in Zend_Exception. See http://lars.schokokeks.org/php/exception-previous-compat.phps cu, Lars signature.asc Description: Dies ist ein digital signierter Nachrichtenteil
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
In 5.3 you can pass the previous exception to the current as the third parameter. The previous exception can than later be retrieved with $exception-getPrevious(). Sorry, sent too early. What I wanted to add was: this could be easily implemented for compatibility in Zend_Exception. See http://lars.schokokeks.org/php/exception-previous-compat.php How would I go about suggesting/contributing this to Zend_Exception? Can anyone add this easily? Christoph
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
-- peter fiksman [EMAIL PROTECTED] wrote (on Sunday, 20 July 2008, 11:33 AM +0200): Zend_Exception has currently no content and just extends the standard Excepton class. Maybe it would make sense to add something like addListener(Zend_Observer_Interface $o) method to implement the observer/observable pattern? This would make possible adding a logger object as a listener. There are cases in ZF where an exception is caught and replaced by throwing another one, which is more general. The details and the origin of the error are lost then. It would be nice to be able to log all exceptions in the execution flow, I think. I've thought that myself a number of times; I actually did exactly this when I was developing Cgiapp (a PHP clone of perl's CGI::Application), and it has a bunch of use cases. However, such a change will not happen until 2.0. I'm marking it in the wiki as a potential improvement. http://framework.zend.com/wiki/display/ZFDEV/Zend_Exception -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
I've thought that myself a number of times; I actually did exactly this when I was developing Cgiapp (a PHP clone of perl's CGI::Application), and it has a bunch of use cases. You may want to update Development is currently in an active phase on your http://cgiapp.sourceforge.net/ page :) However, such a change will not happen until 2.0. I'm marking it in the wiki as a potential improvement. Why is that? Christoph
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
-- Christoph Dorn [EMAIL PROTECTED] wrote (on Wednesday, 23 July 2008, 01:10 PM -0600): I've thought that myself a number of times; I actually did exactly this when I was developing Cgiapp (a PHP clone of perl's CGI::Application), and it has a bunch of use cases. You may want to update Development is currently in an active phase on your http://cgiapp.sourceforge.net/ page :) LOL! Yes... I actually plan to abandon the project at this point. However, such a change will not happen until 2.0. I'm marking it in the wiki as a potential improvement. Why is that? Zend_Exception is used _everywhere_. Introducing a change like this then has ramifications throughout the framework -- not just in terms of potential changes in handling, but also in terms of performance (adding exception listeners means more code loaded and executed for exceptions, which are already expensive). Basically, it's going to take some time to sort out what effects it has, and I feel that those efforts would be generally better targetted at 2.0 when we're making large changes already. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] adding logic to Zend_Exception: observer pattern for logging
Take a look at the patch: http://lars.schokokeks.org/php/exception-previous-compat.phps It looks completely backwards compatible to me and does not require loading of any additional code. Any new code could chain the exceptions while existing code can be updated over time. This is a reasonable and simple change to do now as it makes Zend_Exception comply to the PHP 5.3 Exception class which is a good thing. I think improved exception handling is very important to assist new users to troubleshoot problems. The exception stack is one of those features that makes it much easier to find the root cause of problems. I see this completely independent from other proposed enhancements (the central/enhanced error codes for example). Christoph Zend_Exception is used _everywhere_. Introducing a change like this then has ramifications throughout the framework -- not just in terms of potential changes in handling, but also in terms of performance (adding exception listeners means more code loaded and executed for exceptions, which are already expensive). Basically, it's going to take some time to sort out what effects it has, and I feel that those efforts would be generally better targetted at 2.0 when we're making large changes already.