Last modified: 2014-04-29 14:09:36 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65481, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63481 - Improve error handling for hook functions.
Improve error handling for hook functions.
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.23.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-03 13:23 UTC by Daniel Kinzler
Modified: 2014-04-29 14:09 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Kinzler 2014-04-03 13:23:00 UTC
There should be a "fail safe" variant of wfRunHooks (resp Hooks::run) which would catch, log and ignore any exception thrown by a hook function.

THis could be implemented using an optional parameter to Hooks::run which takes an ExceptionHandler object. ExceptionHandler::handleException( Exception $ex ) would return a bool that determins whether the hook should be continued (just like regular hook functions do).

The implementation used per default would just rethrow the exception. An alternative implementation could log the error using wfLogWarning, and then continue (by returning true) or abort (by returning false).

This is more convenient, and allows better control, than just wrapping wfRunHooks in try/catch everywhere.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links