diff --git a/src/Database/Database.php b/src/Database/Database.php index 9ef753f13..6e0c20b77 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -10,6 +10,7 @@ use Utopia\Database\Exception\Conflict as ConflictException; use Utopia\Database\Exception\Dependency as DependencyException; use Utopia\Database\Exception\Duplicate as DuplicateException; +use Utopia\Database\Exception\Index as IndexException; use Utopia\Database\Exception\Limit as LimitException; use Utopia\Database\Exception\NotFound as NotFoundException; use Utopia\Database\Exception\Query as QueryException; @@ -1196,7 +1197,7 @@ public function createCollection(string $id, array $attributes = [], array $inde ); foreach ($indexes as $index) { if (!$validator->isValid($index)) { - throw new DatabaseException($validator->getDescription()); + throw new IndexException($validator->getDescription()); } } } @@ -1934,7 +1935,7 @@ public function updateAttribute(string $collection, string $id, ?string $type = foreach ($indexes as $index) { if (!$validator->isValid($index)) { - throw new DatabaseException($validator->getDescription()); + throw new IndexException($validator->getDescription()); } } } @@ -2835,7 +2836,7 @@ public function createIndex(string $collection, string $id, string $type, array $this->adapter->getInternalIndexesKeys() ); if (!$validator->isValid($index)) { - throw new DatabaseException($validator->getDescription()); + throw new IndexException($validator->getDescription()); } } diff --git a/src/Database/Exception/Index.php b/src/Database/Exception/Index.php new file mode 100644 index 000000000..65524c926 --- /dev/null +++ b/src/Database/Exception/Index.php @@ -0,0 +1,9 @@ +