NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use
trunk.foswiki.org to view this page for some minimal testing.
Use
Item9693 for docu changes for 1.2 and 2.0.
Item2496: Handle exceptions thrown during initPlugin
| Priority: |
CurrentState: |
AppliesTo: |
Component: |
WaitingFor: |
| Normal |
Closed |
Engine |
|
|
It can be bleeding difficult to work out what's going wrong, if an exception (or die) is thrown during initPlugin. This is because plugins are inited while the foswiki object is still being constructed, and this construction is outside the try..catch in UI.pm. It's not as simple as moving the code inside that try-catch, because the exception handlers generally rely on a viable session. Usually you end up with an internal server error, with "premature end of script headers", which is a bugger to debug.
The classic scenario is an initPlugin that throws an
OopsException (or
AccessControlException).
We need smarter exception handling.
--
CrawfordCurrie - 11 Dec 2009
Sheltered initPlugin in an exception handler, and cleaned up the handling from UI.
Should report errors in plugins more intelligently, and more importantly recover from them. You can also through the different types of exception from all the handlers in plugins now. Whether that helps Kenneth with
BlackListPlugin remains to be seen.
Note that this is not just an internal refactoring; previously, plugin authors could not throw exceptions from initPlugin. They can now.
--
CrawfordCurrie - 14 Dec 2009