Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index exception #522

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
}
Expand Down Expand Up @@ -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());
}
}
}
Expand Down Expand Up @@ -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());
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/Database/Exception/Index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Utopia\Database\Exception;

use Utopia\Database\Exception;

class Index extends Exception
{
}