}
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 ]
);
}