mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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}`,
|
avatar: `gravatar:${mail}`,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn('%o', e);
|
if (e?.code === 11000) {
|
||||||
throw new UserAlreadyExistError([uid, uname, mail]);
|
// Duplicate Key Error
|
||||||
|
throw new UserAlreadyExistError(Object.values(e?.keyValue || {}));
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user