From 71615f4b99175540815fb00135d611e216bc33df Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Sun, 21 Jul 2024 19:20:29 +0200 Subject: [PATCH] Log Herald rules having disabled Herald rules as condition via phlog() Summary: Do not silently fail when a Herald rule refers in its conditions to a disabled rule. Allow Phorge administrators to get aware by creating an entry in the error log via phlog() instead of crossing fingers that someone may from time to time get the idea to open and read Herald transcripts. This is similar to T15885 / D25735. Refs T15869 Test Plan: 1. Phorge at `0873b36569bfcf502a092870d7d5f4d088ed9003` 2. Set up a Herald rule and disable it 3. Set up a second Herald rule with several conditions, the first condition being "Another Herald rule matches" on the disabled first Herald rule 4. Go to http://phorge.localhost/herald/test/ to apply the Herald rule on a corresponding object 5. See an exception in the resulting transcript at http://phorge.localhost/herald/transcript/123456/ 6. After applying this patch, also find that exception in the error log Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15869 Differential Revision: https://we.phorge.it/D25736 --- src/applications/herald/engine/HeraldEngine.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php index 7987301992..5569c3ddfd 100644 --- a/src/applications/herald/engine/HeraldEngine.php +++ b/src/applications/herald/engine/HeraldEngine.php @@ -593,6 +593,10 @@ final class HeraldEngine extends Phobject { $this->popProfilerRule($rule); if ($caught) { + phlog(pht('An exception occurred executing Herald rule %s: "%s" Review '. + 'the Herald transcripts and correct or disable the problematic rule.', + $rule->getMonogram(), + $caught->getMessage())); throw $caught; }