Shun Miyazawa hace 4 años
padre
commit
8777c8d286
Se han modificado 1 ficheros con 11 adiciones y 5 borrados
  1. 11 5
      packages/app/src/server/service/comment.ts

+ 11 - 5
packages/app/src/server/service/comment.ts

@@ -48,15 +48,21 @@ class CommentService {
 
 
     });
     });
 
 
+    // update
     this.commentEvent.on('update', async(updatedComment) => {
     this.commentEvent.on('update', async(updatedComment) => {
-      this.commentEvent.onUpdate();
+      try {
+        this.commentEvent.onUpdate();
 
 
-      const savedActivity = await this.createCommentActivity(updatedComment, ActivityDefine.ACTION_COMMENT_UPDATE);
+        const savedActivity = await this.createCommentActivity(updatedComment, ActivityDefine.ACTION_COMMENT_UPDATE);
 
 
-      let targetUsers: Types.ObjectId[] = [];
-      targetUsers = await savedActivity.getNotificationTargetUsers();
+        let targetUsers: Types.ObjectId[] = [];
+        targetUsers = await savedActivity.getNotificationTargetUsers();
 
 
-      await this.inAppNotificationService.upsertByActivity(targetUsers, savedActivity);
+        await this.inAppNotificationService.upsertByActivity(targetUsers, savedActivity);
+      }
+      catch (err) {
+        logger.error('Error occurred while handling the comment update event:\n', err);
+      }
 
 
       // TODO: 79713
       // TODO: 79713
       // const { inAppNotificationService } = this.crowi;
       // const { inAppNotificationService } = this.crowi;