feat: finalizing Scraping endpoint

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-10 17:28:49 +01:00
parent 0374ab0e46
commit 073439163b
28 changed files with 447 additions and 86 deletions

View File

@@ -10,11 +10,15 @@ class InMemoryScraperAdapter implements ScraperInterface
{
private ?\Exception $shouldThrowException = null;
public function scrape(ScrapingJob $job): void
public function scrape(ScrapingJob $job): ScrapingJob
{
if ($this->shouldThrowException) {
throw $this->shouldThrowException;
$job->fail($this->shouldThrowException->getMessage());
return $job;
}
$job->complete();
return $job;
}
public function simulateError(\Exception $exception): void