Open cstephen opened 7 years ago
Error events raised by the parser are already caught in the twit module and reemitted as parser-error
events, so the error message above was not caused by an uncaught error event.
It looks like this chunk of code in hashtag-count.js
is the culprit:
self.stream.on('parser-error', function (err) {
self.error = err;
});
I had been using this chunk of code to catch Twitter authorization errors since they show up as parser-error
events too. Setting self.error
causes the script to exit later in hashtag-count.js
:
async.until(
function () {
if (self.error !== undefined) {
return true;
}
...
},
function (next) {
...
},
function () {
...
}
);
Again, this was done intentionally to exit on Twitter authorization errors. But we need to add some code to do something different when JSON parser errors are recognized. It's not worth quitting out of the script for something so minor.
The following error caused my script to exit after running for ~3 weeks:
hashtag-count needs to be modified to handle/ignore errors like this so they don't kill the process.