Don't claim model validation failed if the content couldn't be loaded
authorMarius Hoch <hoo@online.de>
Mon, 16 Nov 2015 22:13:55 +0000 (23:13 +0100)
committerMarius Hoch <hoo@online.de>
Mon, 16 Nov 2015 22:13:55 +0000 (23:13 +0100)
Also include the corresponding revision id in the exception message.

Bug: T118747
Change-Id: If3e5694f8b471045cf62d672f414446cf5365ed5

includes/Revision.php

index a498817..3b98a65 100644 (file)
@@ -1505,11 +1505,18 @@ class Revision implements IDBAccessObject {
                }
 
                $content = $this->getContent( Revision::RAW );
+               $prefixedDBkey = $title->getPrefixedDBkey();
+               $revId = $this->mId;
 
-               if ( !$content || !$content->isValid() ) {
-                       $t = $title->getPrefixedDBkey();
-
-                       throw new MWException( "Content of $t is not valid! Content model is $model" );
+               if ( !$content ) {
+                       throw new MWException(
+                               "Content of revision $revId ($prefixedDBkey) could not be loaded for validation!"
+                       );
+               }
+               if ( !$content->isValid() ) {
+                       throw new MWException(
+                               "Content of revision $revId ($prefixedDBkey) is not valid! Content model is $model"
+                       );
                }
        }