From df5a550fbd638ac5ecead1f94b1882fadd899ee9 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Tue, 22 Aug 2023 11:09:37 +0200 Subject: [PATCH] DataQuery: properly log exceptions. Signed-off-by: Claus-Justus Heine --- lib/Query/DataQuery.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/Query/DataQuery.php b/lib/Query/DataQuery.php index 81e01c6..8feefd1 100644 --- a/lib/Query/DataQuery.php +++ b/lib/Query/DataQuery.php @@ -109,13 +109,13 @@ class DataQuery } $query = $this->queryProvider[$queryName]; + try { $result = $this->connection->prepare($query, $limit, $offset); } catch (DBALException $exception) { - $this->logger->error( - "Could not prepare the query: " . $exception->getMessage(), - ["app" => $this->appName] - ); + $this->logger->logException( + $exception, [ 'message' => "Could not prepare the query: " . $query ] + ); return false; } @@ -123,20 +123,16 @@ class DataQuery $result->bindValue(":" . $param, $value); } - $this->logger->debug( - "Executing query: " . $query . ", " . implode(",", $params), - ["app" => $this->appName] - ); + $this->logger->debug("Executing query: " . $query . ", " . implode(",", $params)); try { $result = $result->execute(); return $result; } catch (DBALException $exception) { - $this->logger->error( - "Could not execute the query: " . $exception->getMessage(), - ["app" => $this->appName] - ); + $this->logger->logException( + $exception, [ 'message' => "Could not execute the query: " . $query ] + ); return false; } }