Item2496: Handle exceptions thrown during initPlugin
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
We need smarter exception handling.
- 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.
- 14 Dec 2009