Correct Exceptions

This commit is contained in:
Juan Pablo Vial
2025-06-06 17:37:42 -04:00
parent 13b246b998
commit 5134630525
2 changed files with 7 additions and 8 deletions

View File

@ -28,7 +28,7 @@ class Queue extends Ideal\Service
try {
$this->jobService->add($configuration);
return true;
} catch (Create $exception) {
} catch (Read $exception) {
$final = new Exception("Could not enqueue job", 0, $exception);
$this->logger->warning($final);
return false;
@ -82,12 +82,10 @@ class Queue extends Ideal\Service
}
public function run(?RequestInterface $request = null): bool
{
try {
$jobs = $this->jobService->getPending();
} catch (Read $exception) {
$final = new Exception("Could not get pending jobs", 0, $exception);
$this->logger->warning($final);
return false;
$jobs = $this->jobService->getPending();
if (count($jobs) === 0) {
$this->logger->debug("No pending jobs");
return true;
}
$errors = [];