X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiOpenSearch.php;h=e6fe27ca2a34a1dce4c65bed46d5480034788137;hb=3287201b673c6e52c04e9f8771c0e71d1a617910;hp=ace776c92396d9a83f979c22e98f1422f68c6b20;hpb=47437e0653542aae57ea456b24486efb48ee8aac;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index ace776c923..e6fe27ca2a 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -391,14 +391,14 @@ class ApiOpenSearchFormatJson extends ApiFormatJson { } public function execute() { - if ( !$this->getResult()->getResultData( 'error' ) ) { - $result = $this->getResult(); - + $result = $this->getResult(); + if ( !$result->getResultData( 'error' ) && !$result->getResultData( 'errors' ) ) { // Ignore warnings or treat as errors, as requested $warnings = $result->removeValue( 'warnings', null ); if ( $this->warningsAsError && $warnings ) { - $this->dieUsage( - 'Warnings cannot be represented in OpenSearch JSON format', 'warnings', 0, + $this->dieWithError( + 'apierror-opensearch-json-warnings', + 'warnings', [ 'warnings' => $warnings ] ); }