Skip to content

Commit 5530801

Browse files
authored
Merge pull request #522 from utopia-php/index-exception
Index exception
2 parents ff3fd22 + 54f6981 commit 5530801

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Database/Database.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Utopia\Database\Exception\Conflict as ConflictException;
1111
use Utopia\Database\Exception\Dependency as DependencyException;
1212
use Utopia\Database\Exception\Duplicate as DuplicateException;
13+
use Utopia\Database\Exception\Index as IndexException;
1314
use Utopia\Database\Exception\Limit as LimitException;
1415
use Utopia\Database\Exception\NotFound as NotFoundException;
1516
use Utopia\Database\Exception\Query as QueryException;
@@ -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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Utopia\Database\Exception;
4+
5+
use Utopia\Database\Exception;
6+
7+
class Index extends Exception
8+
{
9+
}

0 commit comments

Comments
 (0)