Merge pull request #22459 from mlutfy/core983acl
[civicrm-core.git] / Civi / Payment / PropertyBag.php
index 25e4a1d3698f6fb00cc85f690b0821a173c976ec..6b39c0f74c6c494bc34e8fe05d7bb1c289bd1c8f 100644 (file)
@@ -1037,7 +1037,10 @@ class PropertyBag implements \ArrayAccess {
    */
   public function setRecurInstallments($recurInstallments, $label = 'default') {
     // Counts zero as positive which is ok - means no installments
-    if (!\CRM_Utils_Type::validate($recurInstallments, 'Positive')) {
+    try {
+      \CRM_Utils_Type::validate($recurInstallments, 'Positive');
+    }
+    catch (\CRM_Core_Exception $e) {
       throw new InvalidArgumentException('recurInstallments must be 0 or a positive integer');
     }