From f6302c7ee3009c5d3b84c4ca84bbaac7da5cc13c Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 19 Jul 2024 15:28:07 +0200 Subject: [PATCH] Log Herald rules with invalid keys via phlog() Summary: When Herald rules fail unexpectedly due to relying on a (now) invalid key, 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. Refs T15885 Test Plan: See steps in T15885; check error log. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15885 Differential Revision: https://we.phorge.it/D25735 --- src/applications/herald/engine/HeraldEngine.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php index 43c3197e1a..7987301992 100644 --- a/src/applications/herald/engine/HeraldEngine.php +++ b/src/applications/herald/engine/HeraldEngine.php @@ -532,8 +532,12 @@ final class HeraldEngine extends Phobject { if ($caught) { $result_data = array( 'exception.class' => get_class($caught), - 'exception.message' => $ex->getMessage(), + 'exception.message' => $caught->getMessage(), ); + 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())); } $result = HeraldConditionResult::newFromResultCode($result_code)