javascript - object Object error when passing object property to twitter api -


i using twitter npm package library create twitter bot interacts tweets on twitter retweeting, favoriting, , reposting tweets. functions operate correctly. however, every bot throw [object object] error , crash program until restarted. here functions using interact tweets.

function interactposttweet(link, tweetparams) {     client.post(link, tweetparams, function (error, tweet, response) {       if (error) {         throw error; //error thrown on line, , [object object] error message       }     });   } function posttweet(tweettext) {   var update = 'statuses/update';   var params = {'status': tweettext};   interactposttweet(update, params);   console.log("tweeted: " + tweettext);  } function favoritetweet(id) {   var favorite = 'favorites/create';   var params = {'id': id};   interactposttweet(favorite, params); } function retweettweet(id) {   var retweet = 'statuses/retweet/' + id + ".json";   var params = {'id': id};   interactposttweet(retweet, params); } 

from i've read, seems [object object] error arising passing params object client.post function. client object a twitter object comes twitter npm library. here documentation npm library.

client.get(path, params, callback); client.post(path, params, callback); client.stream(path, params, callback);  client.get('favorites/list', function(error, tweets, response){   if(error) throw error;   console.log(tweets);  // favorites.    console.log(response);  // raw response object.  });  client.post('statuses/update', {status: 'i love twitter'},  function(error, tweet, response){   if(error) throw error;   console.log(tweet);  // tweet body.    console.log(response);  // raw response object.  }); 

the code works retweet, favorite, , post tweets, problem crashes no discernible reason. use try catch possibly since i'm not sure causing error i'm not sure how resolve issue when caught.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -