From 165443046acebbd610fc087669b2dfbbe4d12170 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 1 Jul 2024 17:15:23 +0200 Subject: [PATCH] fix(db): Interface `Doctrine\DBAL\Exception` cannot be instantiated Signed-off-by: Joas Schilling --- lib/private/DB/Connection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 0b65745e473..9f0fa172f13 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -11,6 +11,7 @@ namespace OC\DB; use Doctrine\Common\EventManager; use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Configuration; +use Doctrine\DBAL\ConnectionException; use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Exception; @@ -136,7 +137,7 @@ class Connection extends PrimaryReadReplicaConnection { return $status; } catch (Exception $e) { // throw a new exception to prevent leaking info from the stacktrace - throw new Exception('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); + throw new ConnectionException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); } }