From dfa539f8a4aa9a673808fdd16768dd1e90c90173 Mon Sep 17 00:00:00 2001 From: boomzillawtf Date: Thu, 16 Jun 2016 14:01:04 -0400 Subject: [PATCH] Fix nex bit of error handling after calling google api. --- library.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library.js b/library.js index 64447d5..6dfa14c 100644 --- a/library.js +++ b/library.js @@ -59,7 +59,7 @@ YoutubeLite.apiRequest = function( videoId, callback ){ }); req.end(); - req.on('error', (err) => { + req.on('error', (err) => { callback( err ); }); } @@ -72,6 +72,9 @@ YoutubeLite.fetchSnippet = function( videoId, callback ){ else{ if( YoutubeLite.apiKey ){ return YoutubeLite.apiRequest( videoId, function(err, videos){ + if( err ){ + callback(err); + } videos = JSON.parse(videos); if( !videos.items || videos.items.length == 0 ){ cache.set( videoId, null );