From 59e5ce0664e3bbe039e307acbc70c192610f68fe Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 16:44:19 +0530 Subject: [PATCH] update: `collections` <> `tables` errors. --- app/config/errors.php | 20 +++++++++---------- app/controllers/general.php | 2 +- src/Appwrite/Extend/Exception.php | 6 +++--- .../Modules/Databases/Http/Columns/Action.php | 6 +++--- .../Modules/Databases/Http/Columns/Delete.php | 4 ++-- .../Modules/Databases/Http/Columns/Get.php | 2 +- .../Http/Columns/Relationship/Create.php | 4 ++-- .../Modules/Databases/Http/Columns/XList.php | 2 +- .../Modules/Databases/Http/Indexes/Create.php | 2 +- .../Modules/Databases/Http/Indexes/Delete.php | 2 +- .../Modules/Databases/Http/Indexes/Get.php | 2 +- .../Modules/Databases/Http/Indexes/XList.php | 2 +- .../Modules/Databases/Http/Rows/Create.php | 4 ++-- .../Modules/Databases/Http/Rows/Delete.php | 4 ++-- .../Modules/Databases/Http/Rows/Get.php | 2 +- .../Databases/Http/Rows/Logs/XList.php | 2 +- .../Modules/Databases/Http/Rows/Update.php | 4 ++-- .../Modules/Databases/Http/Rows/XList.php | 2 +- .../Modules/Databases/Http/Tables/Create.php | 4 ++-- .../Modules/Databases/Http/Tables/Delete.php | 2 +- .../Modules/Databases/Http/Tables/Get.php | 2 +- .../Databases/Http/Tables/Logs/XList.php | 2 +- .../Modules/Databases/Http/Tables/Update.php | 2 +- .../Databases/Http/Tables/Usage/Get.php | 2 +- .../Databases/DatabasesCustomServerTest.php | 2 +- 25 files changed, 44 insertions(+), 44 deletions(-) diff --git a/app/config/errors.php b/app/config/errors.php index 9d30170c2d..6923090ee1 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -657,20 +657,20 @@ return [ 'code' => 400, ], - /** Collections */ - Exception::COLLECTION_NOT_FOUND => [ - 'name' => Exception::COLLECTION_NOT_FOUND, - 'description' => 'Collection with the requested ID could not be found.', + /** Tables */ + Exception::TABLE_NOT_FOUND => [ + 'name' => Exception::TABLE_NOT_FOUND, + 'description' => 'Table with the requested ID could not be found.', 'code' => 404, ], - Exception::COLLECTION_ALREADY_EXISTS => [ - 'name' => Exception::COLLECTION_ALREADY_EXISTS, - 'description' => 'A collection with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.', + Exception::TABLE_ALREADY_EXISTS => [ + 'name' => Exception::TABLE_ALREADY_EXISTS, + 'description' => 'A table with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.', 'code' => 409, ], - Exception::COLLECTION_LIMIT_EXCEEDED => [ - 'name' => Exception::COLLECTION_LIMIT_EXCEEDED, - 'description' => 'The maximum number of collections has been reached.', + Exception::TABLE_LIMIT_EXCEEDED => [ + 'name' => Exception::TABLE_LIMIT_EXCEEDED, + 'description' => 'The maximum number of tables has been reached.', 'code' => 400, ], diff --git a/app/controllers/general.php b/app/controllers/general.php index 6f46f529ce..a0e707ea2f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1185,7 +1185,7 @@ App::error() $error = new AppwriteException(AppwriteException::RELATIONSHIP_VALUE_INVALID, $error->getMessage(), previous: $error); break; case 'Utopia\Database\Exception\NotFound': - $error = new AppwriteException(AppwriteException::COLLECTION_NOT_FOUND, $error->getMessage(), previous: $error); + $error = new AppwriteException(AppwriteException::TABLE_NOT_FOUND, $error->getMessage(), previous: $error); break; case 'Utopia\Database\Exception\Dependency': $error = new AppwriteException(AppwriteException::INDEX_DEPENDENCY, null, previous: $error); diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 7df9134c9f..0ea0c16174 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -192,9 +192,9 @@ class Exception extends \Exception public const DATABASE_QUERY_ORDER_NULL = 'database_query_order_null'; /** Collections */ - public const COLLECTION_NOT_FOUND = 'collection_not_found'; - public const COLLECTION_ALREADY_EXISTS = 'collection_already_exists'; - public const COLLECTION_LIMIT_EXCEEDED = 'collection_limit_exceeded'; + public const TABLE_NOT_FOUND = 'table_not_found'; + public const TABLE_ALREADY_EXISTS = 'table_already_exists'; + public const TABLE_LIMIT_EXCEEDED = 'table_limit_exceeded'; /** Documents */ public const DOCUMENT_NOT_FOUND = 'document_not_found'; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Action.php index 70c26594a3..109844534b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Action.php @@ -78,7 +78,7 @@ class Action extends UtopiaAction $table = $dbForProject->getDocument('database_' . $db->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } if (!empty($format)) { @@ -100,7 +100,7 @@ class Action extends UtopiaAction $options['side'] = Database::RELATION_SIDE_PARENT; $relatedTable = $dbForProject->getDocument('database_' . $db->getInternalId(), $options['relatedCollection'] ?? ''); if ($relatedTable->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND, 'The related table was not found.'); + throw new Exception(Exception::TABLE_NOT_FOUND, 'The related table was not found.'); } } @@ -229,7 +229,7 @@ class Action extends UtopiaAction $table = $dbForProject->getDocument('database_' . $db->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $column = $dbForProject->getDocument('attributes', $db->getInternalId() . '_' . $table->getInternalId() . '_' . $key); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Delete.php index 945097e66b..c4c681b080 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Delete.php @@ -81,7 +81,7 @@ class Delete extends Action $table = $dbForProject->getDocument('database_' . $db->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $column = $dbForProject->getDocument('attributes', $db->getInternalId() . '_' . $table->getInternalId() . '_' . $key); @@ -109,7 +109,7 @@ class Delete extends Action if ($options['twoWay']) { $relatedTable = $dbForProject->getDocument('database_' . $db->getInternalId(), $options['relatedCollection']); if ($relatedTable->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $relatedColumn = $dbForProject->getDocument('attributes', $db->getInternalId() . '_' . $relatedTable->getInternalId() . '_' . $options['twoWayKey']); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Get.php index 160ab60868..091b778eb8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Get.php @@ -75,7 +75,7 @@ class Get extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $column = $dbForProject->getDocument('attributes', $database->getInternalId() . '_' . $table->getInternalId() . '_' . $key); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Relationship/Create.php index d063c8e055..9628d79a92 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Columns/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Columns/Relationship/Create.php @@ -105,13 +105,13 @@ class Create extends ColumnAction $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); $table = $dbForProject->getCollection('database_' . $database->getInternalId() . '_collection_' . $table->getInternalId()); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $relatedTableDocument = $dbForProject->getDocument('database_' . $database->getInternalId(), $relatedTableId); $relatedTable = $dbForProject->getCollection('database_' . $database->getInternalId() . '_collection_' . $relatedTableDocument->getInternalId()); if ($relatedTable->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $columns = $table->getAttribute('attributes', []); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Columns/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Columns/XList.php index e9800e71a0..2b212e2be3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Columns/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Columns/XList.php @@ -68,7 +68,7 @@ class XList extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $queries = Query::parseQueries($queries); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Create.php index 49cb7157b0..1b45f58a2f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Create.php @@ -85,7 +85,7 @@ class Create extends Action $table = $dbForProject->getDocument('database_' . $db->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $count = $dbForProject->count('indexes', [ diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Delete.php index eeb772e0c3..78e1799164 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Delete.php @@ -74,7 +74,7 @@ class Delete extends Action $table = $dbForProject->getDocument('database_' . $db->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $index = $dbForProject->getDocument('indexes', $db->getInternalId() . '_' . $table->getInternalId() . '_' . $key); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Get.php index 72ab1a02b1..b1689481ed 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/Get.php @@ -67,7 +67,7 @@ class Get extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $index = $table->find('key', $key, 'indexes'); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/XList.php index 4920b679c1..53c623f9f4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Indexes/XList.php @@ -73,7 +73,7 @@ class XList extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $queries = Query::parseQueries($queries); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Create.php index 55efbc3632..adf481c1c4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Create.php @@ -106,7 +106,7 @@ class Create extends Action $table = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId)); if ($table->isEmpty() || (!$table->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $allowedPermissions = [ @@ -246,7 +246,7 @@ class Create extends Action } catch (DuplicateException) { throw new Exception(Exception::DOCUMENT_ALREADY_EXISTS); } catch (NotFoundException) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Delete.php index bba042bca5..16e16b7d73 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Delete.php @@ -84,7 +84,7 @@ class Delete extends Action $table = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId)); if ($table->isEmpty() || (!$table->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } // Read permission should not be required for delete @@ -102,7 +102,7 @@ class Delete extends Action ); }); } catch (NotFoundException) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } // Add $tableId and $databaseId for all rows diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Get.php index 85b6127bd3..f2da5e69f4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Get.php @@ -79,7 +79,7 @@ class Get extends Action $table = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId)); if ($table->isEmpty() || (!$table->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } try { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Logs/XList.php index 02358be8f2..43e61c1434 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Logs/XList.php @@ -81,7 +81,7 @@ class XList extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $row = $dbForProject->getDocument('database_' . $database->getInternalId() . '_collection_' . $table->getInternalId(), $rowId); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Update.php index c9ed71d569..6de7e6ae92 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/Update.php @@ -101,7 +101,7 @@ class Update extends Action $table = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId)); if ($table->isEmpty() || (!$table->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } // Read permission should not be required for update @@ -243,7 +243,7 @@ class Update extends Action } catch (StructureException $e) { throw new Exception(Exception::DOCUMENT_INVALID_STRUCTURE, $e->getMessage()); } catch (NotFoundException) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } // Add $tableId and $databaseId for all rows diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Rows/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Rows/XList.php index 4396c2b112..95410507bf 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Rows/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Rows/XList.php @@ -79,7 +79,7 @@ class XList extends Action $table = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId)); if ($table->isEmpty() || (!$table->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } try { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Create.php index 9acd248190..dc3f7b8574 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Create.php @@ -99,9 +99,9 @@ class Create extends Action $dbForProject->createCollection('database_' . $database->getInternalId() . '_collection_' . $table->getInternalId(), permissions: $permissions, documentSecurity: $documentSecurity); } catch (DuplicateException) { - throw new Exception(Exception::COLLECTION_ALREADY_EXISTS); + throw new Exception(Exception::TABLE_ALREADY_EXISTS); } catch (LimitException) { - throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED); + throw new Exception(Exception::TABLE_LIMIT_EXCEEDED); } $queueForEvents diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Delete.php index 6fe7228ed9..b7e8f6ecf7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Delete.php @@ -71,7 +71,7 @@ class Delete extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } if (!$dbForProject->deleteDocument('database_' . $database->getInternalId(), $tableId)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Get.php index 63bc1fa48c..4c76c1f89d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Get.php @@ -66,7 +66,7 @@ class Get extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $response->dynamic($table, UtopiaResponse::MODEL_TABLE); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Logs/XList.php index 44a850424f..1dba2493cf 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Logs/XList.php @@ -81,7 +81,7 @@ class XList extends Action $table = $dbForProject->getCollection('database_' . $database->getInternalId() . '_collection_' . $tableDocument->getInternalId()); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } try { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Update.php index d5f8d388ab..f5621feab3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Update.php @@ -77,7 +77,7 @@ class Update extends Action $table = $dbForProject->getDocument('database_' . $database->getInternalId(), $tableId); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $permissions ??= $table->getPermissions() ?? []; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Usage/Get.php index 4c591bff1a..b528fee7cf 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/Usage/Get.php @@ -68,7 +68,7 @@ class Get extends Action $table = $dbForProject->getCollection('database_' . $database->getInternalId() . '_collection_' . $tableDocument->getInternalId()); if ($table->isEmpty()) { - throw new Exception(Exception::COLLECTION_NOT_FOUND); + throw new Exception(Exception::TABLE_NOT_FOUND); } $periods = Config::getParam('usage', []); diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index 508578f149..a5beb77bf3 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -3491,7 +3491,7 @@ class DatabasesCustomServerTest extends Scope ]), $payload); $this->assertEquals(404, $update['headers']['status-code']); - $this->assertEquals(AppwriteException::COLLECTION_NOT_FOUND, $update['body']['type']); + $this->assertEquals(AppwriteException::TABLE_NOT_FOUND, $update['body']['type']); /** * Check if Attribute exists