Index: trunk/extensions/CodeReview/backend/CodeRepository.php |
— | — | @@ -515,4 +515,24 @@ |
516 | 516 | ); |
517 | 517 | return self::$authorLinks[$name] = $res; |
518 | 518 | } |
| 519 | + |
| 520 | + /** |
| 521 | + * @static |
| 522 | + * @param int $error |
| 523 | + * @return string |
| 524 | + */ |
| 525 | + public static function getDiffErrorMessage( $error ) { |
| 526 | + switch( $error ) { |
| 527 | + case self::DIFFRESULT_BadRevision: |
| 528 | + return 'Bad revision specified.'; |
| 529 | + case self::DIFFRESULT_TooManyPaths: |
| 530 | + return 'Too many paths returned to diff'; |
| 531 | + case self::DIFFRESULT_NoDataReturned: |
| 532 | + return 'No data returned for diff'; |
| 533 | + case self::DIFFRESULT_NotInCache: |
| 534 | + return 'Not in cache'; |
| 535 | + default: |
| 536 | + return 'Unknown'; |
| 537 | + } |
| 538 | + } |
519 | 539 | } |
Index: trunk/extensions/CodeReview/api/ApiCodeDiff.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | |
44 | 44 | if ( !is_string( $diff ) ) { |
45 | 45 | // FIXME: Are we sure we don't want to throw an error here? |
46 | | - $html = 'Failed to load diff.'; |
| 46 | + $html = 'Failed to load diff. ' . CodeRepository::getDiffErrorMessage( $diff ); |
47 | 47 | } elseif ( strlen( $diff ) > $wgCodeReviewMaxDiffSize ) { |
48 | 48 | $html = 'Diff too large.'; |
49 | 49 | } else { |