added a failed status when empty mosaic is create;
This commit is contained in:
parent
38d0371381
commit
2863c9a657
|
|
@ -65,6 +65,7 @@ public function handle(): void
|
||||||
->env(['PATH' => $currentPath.':/usr/local/Cellar/pandoc/3.1.8/bin/pandoc'])
|
->env(['PATH' => $currentPath.':/usr/local/Cellar/pandoc/3.1.8/bin/pandoc'])
|
||||||
->start($command, function (string $type, string $output) use ($project) {
|
->start($command, function (string $type, string $output) use ($project) {
|
||||||
ProjectLogger::log($project, $output);
|
ProjectLogger::log($project, $output);
|
||||||
|
$this->throwIfOutputContainsError($output);
|
||||||
});
|
});
|
||||||
$results = $process->wait();
|
$results = $process->wait();
|
||||||
if ($results->successful()) {
|
if ($results->successful()) {
|
||||||
|
|
@ -112,4 +113,12 @@ public static function handleFor(Project $project, Carbon $endDate, int $offset)
|
||||||
]);
|
]);
|
||||||
return new self($mosaic);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue