mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-13 05:37:44 +02:00
youtube: return different error message if video doesn't exist
This commit is contained in:
@ -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' };
|
||||
|
Reference in New Issue
Block a user