소스 검색

add throwing error

yohei0125 4 년 전
부모
커밋
52e8a97072
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      packages/app/src/server/service/page.ts

+ 4 - 1
packages/app/src/server/service/page.ts

@@ -2369,7 +2369,10 @@ class PageService {
 
       // find pages again to get updated descendantCount
       // then calculate inc
-      const pageAfterUpdatingDescendantCount = await Page.findByIdAndViewer(page._id, user, null, true);
+      const pageAfterUpdatingDescendantCount = await Page.findByIdAndViewer(page._id, user);
+      if (pageAfterUpdatingDescendantCount == null) {
+        throw Error('Faild to fetch page after updating descendantCount');
+      }
 
       const exDescendantCount = page.descendantCount;
       const newDescendantCount = pageAfterUpdatingDescendantCount.descendantCount;