avivace / RSSnotifier

Node RSS reader telegram bot. Provides notification on queries-matching elements and supports multiple users.
GNU General Public License v3.0
16 stars 2 forks source link

Handle malformed feeds #9

Closed avivace closed 5 years ago

avivace commented 6 years ago

A malformed, interrupted or bad-formatted feed usually crashes the feed parser

dennib commented 5 years ago

Addressing this in 16bc4c1 :

FeedParseDone was called with an error on every parse-related error occured during feed parsing process and inside of it we were forcing the bot to crash with

function feedParseDone(err, rows) {
    log(rows, 1)
    if (err) {
        log(err, err.stack, 0);
        return process.exit(1);
    }
}

With last changes we're now avoiding the crash simply logging "an error message" in correspondence of the problematic feed (Full error stack available with logging level 1).

function feedParseDone(err, rows) {
    log(rows, 1)
    if (err) {
        log('Error on feed...', 0);
        log(err, err.stack, 1);
    }
}

A "cooldown" system for problematic feeds is surely still required but at least the bot can continue to work properly checking the other ones.

I've been testing this for some days now, seems to run flawlessly :P