From 4553d7667de83df0f9eb17a69a4ccb19143473bc Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <4953689+christophlehmann@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:18:54 +0200 Subject: [PATCH] [TASK] Do not ignore database exceptions This removes a try catch block around a select query. When a database query is not okay for any reason, then i like to get the reason directly. --- .../Queue/UpdateHandler/GarbageHandler.php | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php index 42e4cbd5a..c63033c46 100644 --- a/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php +++ b/Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php @@ -241,18 +241,14 @@ protected function isRelatedQueueRecordMarkedAsIndexed(string $table, array $rec public function getRecordWithFieldRelevantForGarbageCollection(string $table, int $uid): ?array { $garbageCollectionRelevantFields = $this->tcaService->getVisibilityAffectingFieldsByTable($table); - try { - $queryBuilder = $this->getQueryBuilderForTable($table); - $queryBuilder->getRestrictions()->removeAll(); - $row = $queryBuilder - ->select(...GeneralUtility::trimExplode(',', $garbageCollectionRelevantFields, true)) - ->from($table) - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \Doctrine\DBAL\ParameterType::INTEGER))) - ->executeQuery() - ->fetchAssociative(); - } catch (Throwable) { - $row = false; - } + $queryBuilder = $this->getQueryBuilderForTable($table); + $queryBuilder->getRestrictions()->removeAll(); + $row = $queryBuilder + ->select(...GeneralUtility::trimExplode(',', $garbageCollectionRelevantFields, true)) + ->from($table) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \Doctrine\DBAL\ParameterType::INTEGER))) + ->executeQuery() + ->fetchAssociative(); return is_array($row) ? $row : null; }