diff --git a/lib/Db/EventWrapperRequest.php b/lib/Db/EventWrapperRequest.php
index 7177180c8..b038fdee5 100644
--- a/lib/Db/EventWrapperRequest.php
+++ b/lib/Db/EventWrapperRequest.php
@@ -11,8 +11,8 @@
namespace OCA\Circles\Db;
-use OC\DB\Exceptions\DbalException;
use OCA\Circles\Model\Federated\EventWrapper;
+use OCP\DB\Exception;
use Psr\Log\LoggerInterface;
/**
@@ -42,8 +42,8 @@ public function save(EventWrapper $wrapper): void {
try {
$qb->executeStatement();
- } catch (DbalException $e) {
- if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ } catch (Exception $e) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
diff --git a/lib/Db/TokensRequest.php b/lib/Db/TokensRequest.php
index 96254e887..606e6a402 100644
--- a/lib/Db/TokensRequest.php
+++ b/lib/Db/TokensRequest.php
@@ -8,10 +8,10 @@
namespace OCA\Circles\Db;
-use OC\DB\Exceptions\DbalException;
use OCA\Circles\Exceptions\TokenDoesNotExistException;
use OCA\Circles\Model\DeprecatedMember;
use OCA\Circles\Model\SharesToken;
+use OCP\DB\Exception;
use OCP\Security\IHasher;
use OCP\Server;
@@ -116,8 +116,8 @@ public function generateTokenForMember(DeprecatedMember $member, int $shareId, s
$qb->execute();
$qb->executeStatement();
- } catch (DbalException $e) {
- if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ } catch (Exception $e) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
diff --git a/lib/MountManager/CircleMountProvider.php b/lib/MountManager/CircleMountProvider.php
index 192f42830..980a26d6a 100644
--- a/lib/MountManager/CircleMountProvider.php
+++ b/lib/MountManager/CircleMountProvider.php
@@ -8,8 +8,6 @@
namespace OCA\Circles\MountManager;
-use Exception;
-use OC\DB\Exceptions\DbalException;
use OCA\Circles\Db\MountPointRequest;
use OCA\Circles\Db\MountRequest;
use OCA\Circles\Exceptions\FederatedUserException;
@@ -28,6 +26,7 @@
use OCA\Circles\Service\FederatedUserService;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Files_Sharing\External\Storage as ExternalStorage;
+use OCP\DB\Exception;
use OCP\Federation\ICloudIdManager;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Folder;
@@ -77,7 +76,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader): array {
try {
$this->fixDuplicateFile($user->getUID(), $item);
$mounts[] = $this->generateCircleMount($item, $loader);
- } catch (Exception $e) {
+ } catch (\Exception $e) {
$this->logger->warning('issue with teams\' mounts', ['exception' => $e]);
}
}
@@ -204,9 +203,9 @@ private function fixDuplicateFile(string $userId, Mount $mount): void {
try {
$this->mountPointRequest->insert($mountPoint);
return;
- } catch (DbalException $e) {
+ } catch (Exception $e) {
// meaning a duplicate mountpoint already exists, we need to set a new filename
- if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
@@ -237,9 +236,9 @@ private function generateIncrementedMountpoint(Folder $fs, Mount $mount, IFedera
$this->mountPointRequest->insert($mountPoint);
}
return;
- } catch (DbalException $e) {
+ } catch (Exception $e) {
// meaning path is already used by another share for this user, we keep incrementing
- if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
diff --git a/psalm.xml b/psalm.xml
index bfdedeab4..5fe3895a8 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -40,7 +40,6 @@
-
diff --git a/tests/stubs/oc_db_connectionadapter.php b/tests/stubs/oc_db_connectionadapter.php
index f0fd908d1..c1c3f2ab9 100644
--- a/tests/stubs/oc_db_connectionadapter.php
+++ b/tests/stubs/oc_db_connectionadapter.php
@@ -11,7 +11,6 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
-use OC\DB\Exceptions\DbalException;
use OC\DB\QueryBuilder\Sharded\CrossShardMoveHelper;
use OC\DB\QueryBuilder\Sharded\ShardDefinition;
use OCP\DB\IPreparedStatement;
diff --git a/tests/stubs/oc_db_exceptions_dbalexception.php b/tests/stubs/oc_db_exceptions_dbalexception.php
deleted file mode 100644
index b842d3a9f..000000000
--- a/tests/stubs/oc_db_exceptions_dbalexception.php
+++ /dev/null
@@ -1,47 +0,0 @@
-