jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366748 )

Change subject: Catch exceptions from parseExceptionParameter
......................................................................


Catch exceptions from parseExceptionParameter

parseExceptionParameter can throw a ConstraintParameterException, for
example when the template parameter can’t be parsed or when the
statement parameter is “unknown value” or “no value”. Catch these
exceptions and report them just as in getCheckResultFor().

Bug: T171196
Change-Id: Ifd45994eb6d841fb8404239021c80d526cdff47e
---
M includes/ConstraintCheck/DelegatingConstraintChecker.php
1 file changed, 13 insertions(+), 1 deletion(-)

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



diff --git a/includes/ConstraintCheck/DelegatingConstraintChecker.php 
b/includes/ConstraintCheck/DelegatingConstraintChecker.php
index 339ceee..265536e 100644
--- a/includes/ConstraintCheck/DelegatingConstraintChecker.php
+++ b/includes/ConstraintCheck/DelegatingConstraintChecker.php
@@ -267,7 +267,19 @@
 
                foreach ( $constraints as $constraint ) {
                        $parameters = $constraint->getConstraintParameters();
-                       $exceptions = 
$this->constraintParameterParser->parseExceptionParameter( $parameters );
+                       try {
+                               $exceptions = 
$this->constraintParameterParser->parseExceptionParameter( $parameters );
+                       } catch ( ConstraintParameterException $e ) {
+                               $result[] = new CheckResult(
+                                       $entity->getId(),
+                                       $statement,
+                                       $constraint,
+                                       [],
+                                       CheckResult::STATUS_BAD_PARAMETERS,
+                                       $e->getMessage()
+                               );
+                               continue;
+                       }
 
                        if ( in_array( $entityId, $exceptions ) ) {
                                $result[] = new CheckResult(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd45994eb6d841fb8404239021c80d526cdff47e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: wmf/1.30.0-wmf.10
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to