Revert removal of UniqueConstraintViolationException

This commit is contained in:
Matthias Gutjahr 2021-10-18 10:54:34 +02:00 committed by thrillfall
parent 3e94305d0c
commit 93bfcecf15
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction; namespace OCA\GPodderSync\Core\EpisodeAction;
use DateTime; use DateTime;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionEntity; use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionEntity;
use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionRepository; use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionRepository;
use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionWriter; use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionWriter;
@ -45,6 +46,10 @@ class EpisodeActionSaver
try { try {
$episodeActionEntities[] = $this->episodeActionWriter->save($episodeActionEntity); $episodeActionEntities[] = $this->episodeActionWriter->save($episodeActionEntity);
} catch (UniqueConstraintViolationException $uniqueConstraintViolationException) {
try {
$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 { try {