Yuki Takei 7 лет назад
Родитель
Сommit
29d9efaacc
1 измененных файлов с 4 добавлено и 6 удалено
  1. 4 6
      lib/models/page.js

+ 4 - 6
lib/models/page.js

@@ -801,10 +801,11 @@ module.exports = function(crowi) {
   pageSchema.statics.updateGrant = function(page, grant, userData, grantUserGroupId) {
     var Page = this;
 
-    if (grant == GRANT_USER_GROUP && grantUserGroupId == null) {
-      throw new Error('grant userGroupId is not specified');
-    }
     return new Promise(function(resolve, reject) {
+      if (grant == GRANT_USER_GROUP && grantUserGroupId == null) {
+        reject('grant userGroupId is not specified');
+      }
+
       page.grant = grant;
       if (grant == GRANT_PUBLIC || grant == GRANT_USER_GROUP) {
         page.grantedUsers = [];
@@ -981,9 +982,6 @@ module.exports = function(crowi) {
           resolve(pageData);
           pageEvent.emit('update', pageData, user);
         }
-      }).catch(function(err) {
-        debug('Error on update', err);
-        debug('Error on update', err.stack);
       });
     });
   };