mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: use error code 48 for collection exists exception
The createCollection method threw Exception with code 0 when a collection already exists. The database adapter's processException checks for code 48 (MongoDB NamespaceExists) to convert to DuplicateException, which is then handled gracefully. Without the correct code, the exception propagates as a server error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
45bedf36c2
commit
bf85c7f937
1 file changed
+1
-1
+1
-1
@@ -532,7 +532,7 @@ class Client
|
||||
$list = $this->listCollectionNames(["name" => $name], $options);
|
||||
|
||||
if (\count($list->cursor->firstBatch) > 0) {
|
||||
throw new Exception('Collection Exists');
|
||||
throw new Exception('Collection Exists', 48);
|
||||
}
|
||||
|
||||
$res = $this->query(array_merge([
|
||||
|
||||
Reference in new issue
Block a user