diff --git a/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php b/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php index 8956765..d7e59da 100644 --- a/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php +++ b/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php @@ -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; + } }