Try catch inside

This commit is contained in:
fogelito 2025-09-01 18:35:12 +03:00
parent ad4e3be80c
commit bd8d6fdc59

View file

@ -134,25 +134,19 @@ class Audits extends Action
$logs = $this->logs;
$this->logs = [];
try {
foreach ($logs as $projectLogs) {
/**
* @var $projectDocument Document
*/
foreach ($logs as $projectLogs) {
try {
$projectDocument = $projectLogs['project'];
Console::log('Processing Project "'.$projectDocument->getSequence().'" batch with ' . count($projectLogs['logs']) . ' events');
Console::log('Processing Project "' . $projectDocument->getSequence() . '" batch with ' . count($projectLogs['logs']) . ' events');
$dbForProject = $getProjectDB($projectDocument);
$audit = new Audit($dbForProject);
$audit->logBatch($projectLogs['logs']);
Console::success('Audit logs processed successfully');
} catch (Throwable $e) {
Console::error('Error processing audit logs for Project "' . $projectDocument->getSequence() . '": ' . $e->getMessage());
}
} catch (Throwable $e) {
Console::error('Error processing audit logs: ' . $e->getMessage());
}
$this->lastTriggeredTime = time();
return new Commit();
}