Skip to content

Commit 5e638f8

Browse files
committed
IndexException
1 parent ff3fd22 commit 5e638f8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Database/Database.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Utopia\Database\Exception\Restricted as RestrictedException;
1818
use Utopia\Database\Exception\Structure as StructureException;
1919
use Utopia\Database\Exception\Timeout as TimeoutException;
20+
use Utopia\Database\Exception\Index as IndexException;
2021
use Utopia\Database\Helpers\ID;
2122
use Utopia\Database\Helpers\Permission;
2223
use Utopia\Database\Helpers\Role;
@@ -1196,7 +1197,7 @@ public function createCollection(string $id, array $attributes = [], array $inde
11961197
);
11971198
foreach ($indexes as $index) {
11981199
if (!$validator->isValid($index)) {
1199-
throw new DatabaseException($validator->getDescription());
1200+
throw new IndexException($validator->getDescription());
12001201
}
12011202
}
12021203
}
@@ -1934,7 +1935,7 @@ public function updateAttribute(string $collection, string $id, ?string $type =
19341935

19351936
foreach ($indexes as $index) {
19361937
if (!$validator->isValid($index)) {
1937-
throw new DatabaseException($validator->getDescription());
1938+
throw new IndexException($validator->getDescription());
19381939
}
19391940
}
19401941
}
@@ -2835,7 +2836,7 @@ public function createIndex(string $collection, string $id, string $type, array
28352836
$this->adapter->getInternalIndexesKeys()
28362837
);
28372838
if (!$validator->isValid($index)) {
2838-
throw new DatabaseException($validator->getDescription());
2839+
throw new IndexException($validator->getDescription());
28392840
}
28402841
}
28412842

src/Database/Exception/Index.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Utopia\Database\Exception;
4+
5+
use Utopia\Database\Exception;
6+
7+
class Index extends Exception {}

0 commit comments

Comments
 (0)