mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
youtube: return different error message if video doesn't exist
This commit is contained in:
parent
44ecfeeea7
commit
b7697268e5
1 changed files with 6 additions and 2 deletions
|
@ -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' };
|
||||
|
|
Loading…
Reference in a new issue