added a failed status when empty mosaic is create;

This commit is contained in:
Martin Folkerts 2024-09-02 11:51:12 +02:00
parent 38d0371381
commit 2863c9a657

View file

@ -65,6 +65,7 @@ public function handle(): void
->env(['PATH' => $currentPath.':/usr/local/Cellar/pandoc/3.1.8/bin/pandoc'])
->start($command, function (string $type, string $output) use ($project) {
ProjectLogger::log($project, $output);
$this->throwIfOutputContainsError($output);
});
$results = $process->wait();
if ($results->successful()) {
@ -112,4 +113,12 @@ public static function handleFor(Project $project, Carbon $endDate, int $offset)
]);
return new self($mosaic);
}
private function throwIfOutputContainsError(string $output)
{
if (str_contains($output, 'No images available this week, empty mosaic created')) {
throw new \RuntimeException( $output);
}
return true;
}
}