فهرست منبع

123395 add error handling

soumaeda 2 سال پیش
والد
کامیت
4d9e7f36fa
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      apps/app/src/server/routes/apiv3/users.js

+ 3 - 0
apps/app/src/server/routes/apiv3/users.js

@@ -1002,6 +1002,9 @@ module.exports = (crowi) => {
 
 
     try {
     try {
       const user = await User.findById(id);
       const user = await User.findById(id);
+      if (user == null) {
+        throw new Error('User not found');
+      }
       const userInfo = {
       const userInfo = {
         email: user.email,
         email: user.email,
         password: req.body.newPassword,
         password: req.body.newPassword,