From b7697268e50cc6de2b903dc326e6402ed34ce2e6 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Wed, 29 May 2024 08:28:17 +0000 Subject: [PATCH] youtube: return different error message if video doesn't exist --- src/modules/processing/services/youtube.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/processing/services/youtube.js b/src/modules/processing/services/youtube.js index c97d8c24..fae4e04d 100644 --- a/src/modules/processing/services/youtube.js +++ b/src/modules/processing/services/youtube.js @@ -62,8 +62,12 @@ export default async function(o) { try { info = await yt.getBasicInfo(o.id, 'WEB'); - } catch { - return { error: 'ErrorCantConnectToServiceAPI' }; + } catch(e) { + if (e?.message === 'This video is unavailable') { + return { error: 'ErrorCouldntFetch' }; + } else { + return { error: 'ErrorCantConnectToServiceAPI' }; + } } if (!info) return { error: 'ErrorCantConnectToServiceAPI' };