jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/321423 )
Change subject: Update for API error i18n ...................................................................... Update for API error i18n See Iae0e2ce3. Change-Id: I87dd7a7778e0feb6a1542be51c2ae02b3b1cd996 --- M includes/ApiJsonSchema.php 1 file changed, 23 insertions(+), 4 deletions(-) Approvals: Gergő Tisza: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ApiJsonSchema.php b/includes/ApiJsonSchema.php index d44ff1c..a7caaa4 100644 --- a/includes/ApiJsonSchema.php +++ b/includes/ApiJsonSchema.php @@ -81,18 +81,30 @@ $rev = Revision::newFromID( $params['revid'] ); if ( !$rev ) { - $this->dieUsageMsg( [ 'nosuchrevid', $params['revid'] ] ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-nosuchrevid', $params['revid'] ], null, null, 400 ); + } else { + $this->dieUsageMsg( [ 'nosuchrevid', $params['revid'] ] ); + } } $title = $rev->getTitle(); if ( !$title || !$title->inNamespace( NS_SCHEMA ) ) { - $this->dieUsageMsg( [ 'invalidtitle', $title ] ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ], null, null, 400 ); + } else { + $this->dieUsageMsg( [ 'invalidtitle', $title ] ); + } } /** @var JsonSchemaContent $content */ $content = $rev->getContent(); if ( !$content ) { - $this->dieUsageMsg( [ 'nosuchrevid', $params['revid'] ] ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-nosuchrevid', $params['revid'] ], null, null, 400 ); + } else { + $this->dieUsageMsg( [ 'nosuchrevid', $params['revid'] ] ); + } } // We use the revision ID for lookup; the 'title' parameter is @@ -100,7 +112,14 @@ // revision ID is indeed a revision of a page with the specified // title. (Bug 46174) if ( $params['title'] && !$title->equals( Title::newFromText( $params['title'], NS_SCHEMA ) ) ) { - $this->dieUsageMsg( [ 'revwrongpage', $params['revid'], $params['title'] ] ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( + [ 'apierror-revwrongpage', $params['revid'], wfEscapeWikiText( $params['title'] ) ], + null, null, 400 + ); + } else { + $this->dieUsageMsg( [ 'revwrongpage', $params['revid'], $params['title'] ] ); + } } $this->markCacheable( $rev ); -- To view, visit https://gerrit.wikimedia.org/r/321423 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I87dd7a7778e0feb6a1542be51c2ae02b3b1cd996 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EventLogging Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org> Gerrit-Reviewer: Nuria <nu...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits