24use InvalidArgumentException;
59 throw new InvalidArgumentException( __METHOD__ .
' requires a fatal Status' );
62 $this->modulePath = $module ? $module->
getModulePath() :
null;
67 $enMsg = clone $this->getApiMessage();
68 $enMsg->inLanguage(
'en' )->useDatabase(
false );
82 ?
ApiBase $module, $msg, $code =
null, $data =
null, $httpCode = 0, Throwable $previous =
null
95 private function getApiMessage() {
97 foreach ( $this->status->getMessages(
'error' ) as $msg ) {
101 foreach ( $this->status->getMessages(
'warning' ) as $msg ) {
105 return new ApiMessage(
'apierror-unknownerror-nocode',
'unknownerror' );
128 return Status::wrap( $this->status )->getMessage();
135 $enMsg = clone $this->getApiMessage();
136 $enMsg->inLanguage(
'en' )->useDatabase(
false );
139 return get_class( $this ) .
": {$enMsg->getApiCode()}: {$text} "
140 .
"in {$this->getFile()}:{$this->getLine()}\n"
141 .
"Stack trace:\n{$this->getTraceAsString()}"
142 . ( $this->getPrevious() ?
"\n\nNext {$this->getPrevious()}" :
"" );
148class_alias( ApiUsageException::class,
'ApiUsageException' );
Generic operation result class Has warning/error list, boolean status and arbitrary value.
isOK()
Returns whether the operation completed.
Interface for MediaWiki-localized exceptions.