This lets the client distinguish a legitimately blank diff (identical revisions) from one that does not exist or which they do not have permission to view.
getDiffBody doesn't tell the caller why it failed, so there may be a better way to do this.
$vals['torevid'] = $rev2;
$difftext = $de->getDiffBody();
- ApiResult::setContent( $vals, $difftext );
+
+ if ( $difftext === false ) {
+ $this->dieUsage( 'The diff cannot be retrieved. ' .
+ 'Maybe one or both revisions do not exist or you do not have permission to view them.', 'baddiff' );
+ } else {
+ ApiResult::setContent( $vals, $difftext );
+ }
$this->getResult()->addValue( null, $this->getModuleName(), $vals );
}