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

ItemTemplate edit

Summary Handle exceptions thrown during initPlugin
ReportedBy CrawfordCurrie
Codebase
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:5791
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r6 - 04 Oct 2010, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License