abort updates once it fails

This commit is contained in:
thrillfall 2021-11-03 13:46:04 +01:00
parent 48c4bb779e
commit 239b7773c2

View File

@ -47,14 +47,10 @@ class EpisodeActionSaver
try { try {
$episodeActionEntities[] = $this->episodeActionWriter->save($episodeActionEntity); $episodeActionEntities[] = $this->episodeActionWriter->save($episodeActionEntity);
} catch (UniqueConstraintViolationException $uniqueConstraintViolationException) { } catch (UniqueConstraintViolationException $uniqueConstraintViolationException) {
try {
$episodeActionEntities[] = $this->updateEpisodeAction($episodeActionEntity, $userId); $episodeActionEntities[] = $this->updateEpisodeAction($episodeActionEntity, $userId);
} catch (Exception $exception) {}
} catch (Exception $exception) { } catch (Exception $exception) {
if ($exception->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { if ($exception->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
try {
$episodeActionEntities[] = $this->updateEpisodeAction($episodeActionEntity, $userId); $episodeActionEntities[] = $this->updateEpisodeAction($episodeActionEntity, $userId);
} catch (Exception $exception) {}
} }
} }
} }
@ -67,9 +63,6 @@ class EpisodeActionSaver
->format("U"); ->format("U");
} }
/**
* @throws Exception
*/
private function updateEpisodeAction( private function updateEpisodeAction(
EpisodeActionEntity $episodeActionEntity, EpisodeActionEntity $episodeActionEntity,
string $userId string $userId