From 1907ef7ff4d7158b8ba4fc72114452f999fff1bc Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Tue, 1 Oct 2024 16:17:57 +0200 Subject: [PATCH] GP-46436 Add logging for Error Throwables during action execution --- CRM/Sqltasks/BAO/SqlTask.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CRM/Sqltasks/BAO/SqlTask.php b/CRM/Sqltasks/BAO/SqlTask.php index d056a3c..4c9b375 100644 --- a/CRM/Sqltasks/BAO/SqlTask.php +++ b/CRM/Sqltasks/BAO/SqlTask.php @@ -210,6 +210,13 @@ public function execute($params = []) { $execution->logInfo($log_message); } catch (Exception $e) { $execution->reportError("Error in action '$action_name': " . $e->getMessage()); + } catch (Error $e) { + // log internal PHP error + $execution->reportError("Fatal Error in action '$action_name': " . $e->getMessage()); + $execution->logWarning('Task execution has probably crashed'); + // TODO: decide how to handle internal PHP errors. For now, we just re-throw to trigger the general error handler (and probably exit) + // ideally, we'd want to trigger the task's error handler and continue running, but that could have side-effects + throw $e; } }