node-google
node-google copied to clipboard
app completly crash and server restarted sometimes
Hi @jprichardson , First thanks for this awesome project. But I have a small issue with this module in Meteor. When I try to use proxy in request option sometimes for some proxy my app restarted and crash completely with following error:
W20160607-14:55:35.706(4.5)? (STDERR) events.js:72
W20160607-14:55:35.707(4.5)? (STDERR) throw er; // Unhandled 'error' event
W20160607-14:55:35.707(4.5)? (STDERR) ^
W20160607-14:55:35.710(4.5)? (STDERR) Error: read ECONNRESET
W20160607-14:55:35.710(4.5)? (STDERR) at errnoException (net.js:905:11)
W20160607-14:55:35.711(4.5)? (STDERR) at TCP.onread (net.js:559:19)
=> Exited with code: 8
This is my code:
google.requestOptions = {
proxy: proxy,
timeout: 3000
};
google.resultsPerPage = 50;
let syncGoogle = Meteor.wrapAsync(google);
let googleResult;
try {
googleResult = syncGoogle(keyword);
for (let i = 0; i < googleResult.links.length; ++i) {
// some process on result.
}
}
catch (error) {
console.error("error: " + error);
}
Can you help me to fix this?