]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix error log of bad import
authorChocobozzz <me@florianbigard.com>
Tue, 9 Nov 2021 14:07:06 +0000 (15:07 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 9 Nov 2021 14:07:06 +0000 (15:07 +0100)
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
       })