mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: better duplicate key error msg
This commit is contained in:
1 parent
7e3314774a
commit
fc85ca36dc
1 file changed
+5
-2
@@ -303,8 +303,11 @@ class UserModel {
|
||||
avatar: `gravatar:${mail}`,
|
||||
});
|
||||
} catch (e) {
|
||||
logger.warn('%o', e);
|
||||
throw new UserAlreadyExistError([uid, uname, mail]);
|
||||
if (e?.code === 11000) {
|
||||
// Duplicate Key Error
|
||||
throw new UserAlreadyExistError(Object.values(e?.keyValue || {}));
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user