zamis 5 лет назад
Родитель
Сommit
f6e0eab70b
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/server/service/page.js

+ 7 - 0
src/server/service/page.js

@@ -106,6 +106,7 @@ class PageService {
       pageEvent.on('update', pageEvent.onUpdate);
       pageEvent.on('update', pageEvent.onUpdate);
     }
     }
 
 
+    this.validateCrowi();
     const { _id, path } = pageData;
     const { _id, path } = pageData;
     const socketClientId = options.socketClientId || null;
     const socketClientId = options.socketClientId || null;
 
 
@@ -134,6 +135,12 @@ class PageService {
     }));
     }));
   }
   }
 
 
+  validateCrowi() {
+    if (this.crowi == null) {
+      throw new Error('"crowi" is null. Init User model with "crowi" argument first.');
+    }
+  }
+
 }
 }
 
 
 module.exports = PageService;
 module.exports = PageService;