From d7ce63d3dd63e51096f76371403ac4859d69bef5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Nov 2021 15:07:06 +0100 Subject: Fix error log of bad import --- server/helpers/youtube-dl/youtube-dl-wrapper.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts index edbd28fa4..6442c1e85 100644 --- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts +++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts @@ -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 }) -- cgit v1.2.3