From 6efdbd88eaca9be3b2258a7f4942c9d538e8deba Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 28 Mar 2024 10:10:05 +0200 Subject: [PATCH] use reject instead of throw --- src/client/components/downloaders/Spotify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/components/downloaders/Spotify.ts b/src/client/components/downloaders/Spotify.ts index 1d2c11d..433ef64 100644 --- a/src/client/components/downloaders/Spotify.ts +++ b/src/client/components/downloaders/Spotify.ts @@ -132,13 +132,13 @@ class SpotifyDownloader extends Downloader this.logger.debug('Got ID mismatch, attempting to parse stdout to find filename'); const match = stdout.match(reg); if (!match) - throw new Error('Got bad output from zotify (could not find file name) and could not find by ID from cache file'); + return reject(new Error('Got bad output from zotify (could not find file name) and could not find by ID from cache file')); const { file, name } = match.groups!; fs.appendFileSync(path.join(this.downloadDir!, '.song_ids'), `${id}\t${(new Date()).toLocaleString('sv')}\t${name}\t${file}`); data = this.#parseFilename(file); } if (!data) - throw new Error('Failed to find file reference'); + return reject(new Error('Failed to find file reference')); const { fileName, artist, song, album, ext } = data; const filePath = path.join(this.downloadDir!, fileName);