core: fix

This commit is contained in:
undefined committed 2024-01-28 02:42:49 +08:00
1 parent a863a6501e
commit f5406bfe99
1 file changed
+5 -2
+5 -2
View File
@@ -342,11 +342,14 @@ class UserModel {
} catch (e) {
if (e?.code === 11000) {
// Duplicate Key Error
if (autoAlloc && JSON.stringify(e.keyPattern) === '{"_id":1}') {
uid++;
continue;
}
throw new UserAlreadyExistError(Object.values(e?.keyValue || {}));
}
if (!autoAlloc || JSON.stringify(e.keyPattern) !== '{"_id":1}') throw e;
throw e;
}
uid++;
}
}