Explorar o código

123395 add error handling

soumaeda %!s(int64=2) %!d(string=hai) anos
pai
achega
4d9e7f36fa
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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 {
       const user = await User.findById(id);
+      if (user == null) {
+        throw new Error('User not found');
+      }
       const userInfo = {
         email: user.email,
         password: req.body.newPassword,