jenkins-bot has submitted this change and it was merged.

Change subject: Don't claim model validation failed if the content couldn't be 
loaded
......................................................................


Don't claim model validation failed if the content couldn't be loaded

Also include the corresponding revision id in the exception message.

Bug: T118747
Change-Id: If3e5694f8b471045cf62d672f414446cf5365ed5
---
M includes/Revision.php
1 file changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Revision.php b/includes/Revision.php
index a498817..3b98a65 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -1505,11 +1505,18 @@
                }
 
                $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"
+                       );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/253470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If3e5694f8b471045cf62d672f414446cf5365ed5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to