From 445de3546d9e9b85e59ea2c7a2c9a7f54a57704f Mon Sep 17 00:00:00 2001 From: LuanRT Date: Mon, 25 Oct 2021 01:23:07 -0300 Subject: [PATCH] chore: update examples --- examples/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/index.js b/examples/index.js index 685733d3..7a9c6405 100644 --- a/examples/index.js +++ b/examples/index.js @@ -11,11 +11,13 @@ async function start() { console.info('Search results:', search); if (search.videos.length === 0) - return console.info('[INFO]', 'Could not find any video about that on YouTube.'); + return console.error('Could not find any video about that on YouTube.'); - const video = await youtube.getDetails(search.videos[0].id); + const video = await youtube.getDetails(search.videos[0].id).catch((error) => error); console.info('Video details:', video); - if (video.error) return; + + if (video instanceof Error) + return console.error('Could not get details for ' + search.videos[0].title); if (youtube.logged_in) { const myNotifications = await youtube.getNotifications();