DataQuery: properly log exceptions.
Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
This commit is contained in:
@@ -109,13 +109,13 @@ 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,20 +123,16 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user