Update for API error i18n

See Iae0e2ce3.

Change-Id: I1642929fa48e5354217e0c6de19b4f80b38d94f0
This commit is contained in:
Brad Jorsch 2016-11-03 15:16:56 -04:00
parent eb8699aef6
commit c69e2e5049

View file

@ -13,7 +13,11 @@ class ApiScribuntoConsole extends ApiBase {
$title = Title::newFromText( $params['title'] );
if ( !$title ) {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
if ( is_callable( array( $this, 'dieWithError' ) ) ) {
$this->dieWithError( array( 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ) );
} else {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
}
}
if ( $params['session'] ) {
@ -55,10 +59,14 @@ class ApiScribuntoConsole extends ApiBase {
}
if ( $newSession['size'] > self::SC_MAX_SIZE ) {
$this->dieUsage(
$this->msg( 'scribunto-console-too-large' )->text(),
'scribunto-console-too-large'
);
if ( is_callable( array( $this, 'dieWithError' ) ) ) {
$this->dieWithError( 'scribunto-console-too-large' );
} else {
$this->dieUsage(
$this->msg( 'scribunto-console-too-large' )->text(),
'scribunto-console-too-large'
);
}
}
$result = $this->runConsole( array(
'title' => $title,