Skip to content

Commit

Permalink
[BUGFIX] Scheduler task fails only on errors, not warnings
Browse files Browse the repository at this point in the history
Let Scheduler task succeed on warnings
  • Loading branch information
fsuter authored Feb 25, 2023
2 parents b8b905e + 178fcaa commit 2c13284
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Classes/Task/AutomatedSyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,17 @@ public function execute(): bool
);
if (count($messages[AbstractMessage::ERROR]) > 0) {
$globalStatus = 'ERROR';
} elseif (count($messages[AbstractMessage::WARNING]) > 0) {
$globalStatus = 'WARNING';
}
// Assemble the subject and send the mail
$subject = empty($extensionConfiguration['reportSubject']) ? '' : $extensionConfiguration['reportSubject'];
$subject .= ' [' . $globalStatus . '] ' . 'Synchronization of table ' . $this->table . ', index ' . $this->index;
$importer->getReportingUtility()->sendMail($subject, $reportContent);
}
}
// If any warning or error happened, throw an exception
// If any error happened, throw an exception
if ($globalStatus !== 'OK') {
throw new \Exception(
'One or more errors or warnings happened. Please consult the log.',
'One or more errors happened. Please consult the log.',
1258116760
);
}
Expand Down

0 comments on commit 2c13284

Please sign in to comment.