aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/Exceptions/DbalException.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-02-26 17:37:13 +0100
committerRobin Appelman <robin@icewind.nl>2025-02-26 17:37:13 +0100
commitf3bd4a79d9e70882c0b78664d94b726c1b6a4ec8 (patch)
tree2a61227cbfaa6e32e666e49194b3d9a718befd93 /lib/private/DB/Exceptions/DbalException.php
parent9682ef7025789dd47695fe5087bb4c37ce8332af (diff)
downloadnextcloud-server-dbal-exception-query.tar.gz
nextcloud-server-dbal-exception-query.zip
feat: log query for dbal exceptionsdbal-exception-query
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/DB/Exceptions/DbalException.php')
-rw-r--r--lib/private/DB/Exceptions/DbalException.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/DB/Exceptions/DbalException.php b/lib/private/DB/Exceptions/DbalException.php
index 05ea9e22a5d..2ce6ddf80a6 100644
--- a/lib/private/DB/Exceptions/DbalException.php
+++ b/lib/private/DB/Exceptions/DbalException.php
@@ -35,26 +35,29 @@ use OCP\DB\Exception;
class DbalException extends Exception {
/** @var \Doctrine\DBAL\Exception */
private $original;
+ public readonly ?string $query;
/**
* @param \Doctrine\DBAL\Exception $original
* @param int $code
* @param string $message
*/
- private function __construct(\Doctrine\DBAL\Exception $original, int $code, string $message) {
+ private function __construct(\Doctrine\DBAL\Exception $original, int $code, string $message, ?string $query = null) {
parent::__construct(
$message,
$code,
$original
);
$this->original = $original;
+ $this->query = $query;
}
- public static function wrap(\Doctrine\DBAL\Exception $original, string $message = ''): self {
+ public static function wrap(\Doctrine\DBAL\Exception $original, string $message = '', ?string $query = null): self {
return new self(
$original,
is_int($original->getCode()) ? $original->getCode() : 0,
- empty($message) ? $original->getMessage() : $message
+ empty($message) ? $original->getMessage() : $message,
+ $query,
);
}