Skip to content

Commit

Permalink
Fix nex bit of error handling after calling google api.
Browse files Browse the repository at this point in the history
  • Loading branch information
boomzillawtf committed Jun 16, 2016
1 parent 9c1ed97 commit dfa539f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library.js
Expand Up @@ -59,7 +59,7 @@ YoutubeLite.apiRequest = function( videoId, callback ){
});
req.end();

req.on('error', (err) => {
req.on('error', (err) => {
callback( err );
});
}
Expand All @@ -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 );
Expand Down

0 comments on commit dfa539f

Please sign in to comment.