Skip to content

Commit

Permalink
GP-46436 Add logging for Error Throwables during action execution
Browse files Browse the repository at this point in the history
  • Loading branch information
pfigel committed Oct 1, 2024
1 parent a374d11 commit 1907ef7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CRM/Sqltasks/BAO/SqlTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 1907ef7

Please sign in to comment.