]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/youtube-dl/youtube-dl-wrapper.ts
Translate plugin settings
[github/Chocobozzz/PeerTube.git] / server / helpers / youtube-dl / youtube-dl-wrapper.ts
index edbd28fa466ba1430e77901c87cc95b42fd17590..6442c1e855b2106a0e2685d7be8bdf81b0e52183 100644 (file)
@@ -98,12 +98,14 @@ class YoutubeDLWrapper {
       })
 
     return Promise.race([ downloadPromise, timeoutPromise ])
-      .catch(async err => {
-        const path = await this.guessVideoPathWithExtension(pathWithoutExtension, fileExt)
-
-        logger.debug('Error in youtube-dl import, deleting file %s.', path, { err, ...lTags() })
-        remove(path)
-          .catch(err => logger.error('Cannot remove file in youtubeDL timeout.', { err, ...lTags() }))
+      .catch(err => {
+        this.guessVideoPathWithExtension(pathWithoutExtension, fileExt)
+          .then(path => {
+            logger.debug('Error in youtube-dl import, deleting file %s.', path, { err, ...lTags() })
+
+            return remove(path)
+          })
+          .catch(innerErr => logger.error('Cannot remove file in youtubeDL timeout.', { innerErr, ...lTags() }))
 
         throw err
       })