node.js上的条件断点

时间:2016-03-04 08:50:54

标签: node.js debugging

我正在尝试使用此功能检索Facebook Feed

function getFeeds(url,page,id,count){

graph.get(url, function(err, res) {


   if(!err){
     res.data.forEach(function(item) {
               id.push(item);
            });
     if ( res.paging.next && count>0) setTimeout(getFeeds(res.paging.next,page,id,count-1),100)
      else {
             id.forEach(function(item){
             console.log(item);
           })
    };                  
   }
});
};

但是,此函数会返回此错误

/Users/adelessafi/fb/getfeeds.js:20
     if (res.paging.next  && count>0) setTimeout(getFeeds(res.paging.next,page,id,count-1),100)
                   ^

TypeError: Cannot read property 'next' of undefined
    at Graph.callback (/Users/adelessafi/fb/getfeeds.js:20:20)
    at Graph.end (/Users/adelessafi/fb/node_modules/fbgraph/lib/graph.js:170:8)

我想在错误发生之前停止执行我的脚本。请注意,我的脚本会进行大量调用,因此我必须创建一个条件断点。

提前感谢您的任何参赛作品

1 个答案:

答案 0 :(得分:1)

您可以通过调试器来模拟它; if中的陈述。

Spicy Vegetable Moo Shu|1|True|140

BBQ Pork|1|False|920

只需确保您的调试器已附加。

相关问题