]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-caption.ts
Import torrents with webtorrent
[github/Chocobozzz/PeerTube.git] / server / models / video / video-caption.ts
index 9920dfc7c42816415bbd031033c6dc4d7dfffffd..4a25097f8a6c5a1c152c8d66b4940f7d1f13f7d6 100644 (file)
@@ -75,14 +75,18 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
 
   @BeforeDestroy
   static async removeFiles (instance: VideoCaptionModel) {
+    if (!instance.Video) {
+      instance.Video = await instance.$get('Video') as VideoModel
+    }
 
     if (instance.isOwned()) {
-      if (!instance.Video) {
-        instance.Video = await instance.$get('Video') as VideoModel
-      }
+      logger.info('Removing captions %s of video %s.', instance.Video.uuid, instance.language)
 
-      logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language)
-      return instance.removeCaptionFile()
+      try {
+        await instance.removeCaptionFile()
+      } catch (err) {
+        logger.error('Cannot remove caption file of video %s.', instance.Video.uuid)
+      }
     }
 
     return undefined