mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix
This commit is contained in:
1 file changed
+5
-2
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user