indexException

This commit is contained in:
fogelito committed 2025-02-09 18:34:41 +02:00
1 parent 5d243de029
commit 3092e765cc
2 files changed
+41 -23

No files matched your search

+18
View File
@@ -377,6 +377,19 @@ function updateAttribute(
$dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId());
}
} else {
$validator = new IndexValidator(
$collection->getAttribute('attributes', []),
$dbForProject->getAdapter()->getMaxIndexLength(),
$dbForProject->getAdapter()->getInternalIndexesKeys(),
);
foreach ($collection->getAttribute('indexes', []) as $index){
if (!$validator->isValid($index)) {
throw new Exception(Exception::INDEX_INVALID, $validator->getDescription());
}
}
try {
$dbForProject->updateAttribute(
collection: $collectionId,
@@ -393,6 +406,11 @@ function updateAttribute(
throw new Exception(Exception::ATTRIBUTE_NOT_FOUND);
} catch (LimitException) {
throw new Exception(Exception::ATTRIBUTE_LIMIT_EXCEEDED);
} catch (indexException $e) {
/**
* We do not have index indexException thrown from Utopia...
*/
throw new Exception(Exception::INDEX_INVALID, $e->getDescription());
}
}
Generated
+23 -23
View File
@@ -1237,16 +1237,16 @@
},
{
"name": "open-telemetry/api",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/api.git",
"reference": "74b1a03263be8c5acb578f41da054b4bac3af4a0"
"reference": "8b925df3047628968bc5be722468db1b98b82d51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/74b1a03263be8c5acb578f41da054b4bac3af4a0",
"reference": "74b1a03263be8c5acb578f41da054b4bac3af4a0",
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/8b925df3047628968bc5be722468db1b98b82d51",
"reference": "8b925df3047628968bc5be722468db1b98b82d51",
"shasum": ""
},
"require": {
@@ -1303,7 +1303,7 @@
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2025-01-20T23:35:16+00:00"
"time": "2025-02-03T21:49:11+00:00"
},
{
"name": "open-telemetry/context",
@@ -1493,16 +1493,16 @@
},
{
"name": "open-telemetry/sdk",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/sdk.git",
"reference": "96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1"
"reference": "37eec0fe47ddd627911f318f29b6cd48196be0c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1",
"reference": "96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1",
"url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/37eec0fe47ddd627911f318f29b6cd48196be0c0",
"reference": "37eec0fe47ddd627911f318f29b6cd48196be0c0",
"shasum": ""
},
"require": {
@@ -1579,24 +1579,24 @@
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2025-01-09T23:17:14+00:00"
"time": "2025-01-29T21:40:28+00:00"
},
{
"name": "open-telemetry/sem-conv",
"version": "1.27.1",
"version": "1.30.0",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/sem-conv.git",
"reference": "1dba705fea74bc0718d04be26090e3697e56f4e6"
"reference": "4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/1dba705fea74bc0718d04be26090e3697e56f4e6",
"reference": "1dba705fea74bc0718d04be26090e3697e56f4e6",
"url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a",
"reference": "4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a",
"shasum": ""
},
"require": {
"php": "^8.1"
"php": "^8.0"
},
"type": "library",
"extra": {
@@ -1636,7 +1636,7 @@
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2024-08-28T09:20:31+00:00"
"time": "2025-02-06T00:21:48+00:00"
},
{
"name": "paragonie/constant_time_encoding",
@@ -2453,16 +2453,16 @@
},
{
"name": "symfony/http-client",
"version": "v7.2.2",
"version": "v7.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "339ba21476eb184290361542f732ad12c97591ec"
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/339ba21476eb184290361542f732ad12c97591ec",
"reference": "339ba21476eb184290361542f732ad12c97591ec",
"url": "https://api.github.com/repos/symfony/http-client/zipball/7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
"shasum": ""
},
"require": {
@@ -2528,7 +2528,7 @@
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.2.2"
"source": "https://github.com/symfony/http-client/tree/v7.2.3"
},
"funding": [
{
@@ -2544,7 +2544,7 @@
"type": "tidelift"
}
],
"time": "2024-12-30T18:35:15+00:00"
"time": "2025-01-28T15:51:35+00:00"
},
{
"name": "symfony/http-client-contracts",
@@ -8503,7 +8503,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {