From b52783af80bd310d99b450ddbc4816bd2c5a1978 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 6 Mar 2018 12:12:53 -0800 Subject: [PATCH] (stable) Provide a more tailored error message when a Herald rule fails because of PCRE limits Summary: Ref T13100. Since rules may begin failing for PRCE configuration reasons soon, provide a more complete explanation of possible causes in the UI. Test Plan: Faked this, hit it via test console, saw explanation in web UI. Maniphest Tasks: T13100 Differential Revision: https://secure.phabricator.com/D19178 --- src/applications/herald/adapter/HeraldAdapter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index 08a0ca7a52..a266e21f39 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -490,7 +490,13 @@ abstract class HeraldAdapter extends Phobject { $result = @preg_match($condition_value.'S', $value); if ($result === false) { throw new HeraldInvalidConditionException( - pht('Regular expression is not valid!')); + pht( + 'Regular expression "%s" in Herald rule "%s" is not valid, '. + 'or exceeded backtracking or recursion limits while '. + 'executing. Verify the expression and correct it or rewrite '. + 'it with less backtracking.', + $condition_value, + $rule->getMonogram())); } if ($result) { return $result_if_match;