42 throw new InvalidArgumentException( __METHOD__ .
' requires a fatal Status' );
45 $this->modulePath = $module ? $module->getModulePath() :
null;
51 $enMsg->inLanguage(
'en' )->useDatabase(
false );
64 ApiBase $module =
null, $msg, $code =
null, $data =
null, $httpCode = 0
77 $errors = $this->status->getErrorsByType(
'error' );
79 $errors = $this->status->getErrors();
82 $msg =
new ApiMessage(
'apierror-unknownerror-nocode',
'unknownerror' );
109 return Status::wrap( $this->status )->getMessage();
117 $enMsg->inLanguage(
'en' )->useDatabase(
false );
120 return get_class( $this ) .
": {$enMsg->getApiCode()}: {$text} "
121 .
"in {$this->getFile()}:{$this->getLine()}\n"
122 .
"Stack trace:\n{$this->getTraceAsString()}";
This abstract class implements many basic API functions, and is the base of all API classes.
Extension of Message implementing IApiMessage.
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
Exception used to abort API execution with an error.
getModulePath()
Fetch the responsible module name.
getStatusValue()
Fetch the error status.
static newWithMessage(ApiBase $module=null, $msg, $code=null, $data=null, $httpCode=0)
__construct(ApiBase $module=null, StatusValue $status, $httpCode=0)
getMessageObject()
Return a Message object for this exception.Message
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Interface for MediaWiki-localized exceptions.