diff options
author | Robin Appelman <robin@icewind.nl> | 2025-02-26 17:37:13 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-03-04 15:33:54 +0000 |
commit | 0ae944db2c3ce01c4f78754855849a4af00f50bf (patch) | |
tree | 1f5a995bd34365170ab5b98f75efb32ef53f09a3 /lib/private/DB/Exceptions | |
parent | 72ee217bb4ae8a7942edd9101929120af185e28c (diff) | |
download | nextcloud-server-backport/51073/stable31.tar.gz nextcloud-server-backport/51073/stable31.zip |
feat: log query for dbal exceptionsbackport/51073/stable31
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/DB/Exceptions')
-rw-r--r-- | lib/private/DB/Exceptions/DbalException.php | 9 |
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, ); } |