DataQuery: properly log exceptions.

Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
This commit is contained in:
Claus-Justus Heine
2023-08-22 11:09:37 +02:00
parent 338c6b6ffb
commit df5a550fbd

View File

@@ -109,12 +109,12 @@ class DataQuery
} }
$query = $this->queryProvider[$queryName]; $query = $this->queryProvider[$queryName];
try { try {
$result = $this->connection->prepare($query, $limit, $offset); $result = $this->connection->prepare($query, $limit, $offset);
} catch (DBALException $exception) { } catch (DBALException $exception) {
$this->logger->error( $this->logger->logException(
"Could not prepare the query: " . $exception->getMessage(), $exception, [ 'message' => "Could not prepare the query: " . $query ]
["app" => $this->appName]
); );
return false; return false;
} }
@@ -123,19 +123,15 @@ class DataQuery
$result->bindValue(":" . $param, $value); $result->bindValue(":" . $param, $value);
} }
$this->logger->debug( $this->logger->debug("Executing query: " . $query . ", " . implode(",", $params));
"Executing query: " . $query . ", " . implode(",", $params),
["app" => $this->appName]
);
try { try {
$result = $result->execute(); $result = $result->execute();
return $result; return $result;
} catch (DBALException $exception) { } catch (DBALException $exception) {
$this->logger->error( $this->logger->logException(
"Could not execute the query: " . $exception->getMessage(), $exception, [ 'message' => "Could not execute the query: " . $query ]
["app" => $this->appName]
); );
return false; return false;
} }