Jump to content

Manual:Hooks/ApiMain::onException

From mediawiki.org
ApiMain::onException
Available from version 1.20.0
Called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.
Define function:
public static function onApiMain_onException( ApiMain $apiMain, Exception $e ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiMain::onException": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiMainonException"
	}
}
Called from: File(s): api/ApiMain.php
Interface: ApiMain__onExceptionHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ApiMain::onException extensions.


Details

[edit]

Called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.

  • $apiMain: Calling ApiMain instance.
  • $e: Exception object.