[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[wmf/1.30.0-wmf.10]: Catch exceptions from parseExceptionParameter

2017-07-20 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Lucas Werkmeister (WMDE) 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[wmf/1.30.0-wmf.10]: Catch exceptions from parseExceptionParameter

2017-07-20 Thread Aude (Code Review)
Aude has uploaded a new change for review. ( 
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(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/48/366748/1

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: newchange
Gerrit-Change-Id: Ifd45994eb6d841fb8404239021c80d526cdff47e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: wmf/1.30.0-wmf.10
Gerrit-Owner: Aude 
Gerrit-Reviewer: Lucas Werkmeister (WMDE) 

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