53seven/node-blindparser

Not getting errors properly

Closed this issue · 5 comments

Hello,

Having the following code:

        var options = {
            followRedirect: true,
            timeout: 5000
        };

        parser.parseURL(url, options, function(err, out){
            console.log(out);
            console.log(err);
            if (err) return res.send(400, { error: err });
            return res.send(200, { out: out });
        });

I get a 200 OK with content mismatch and, printed on the console, I got:

[ERROR] 02:08:08 Error
Error: Unexpected close tag
Line: 1158
Column: 9
Char: >

It's impossible to catch the error. What I'm doing wrong?

Can you send me the url that you are trying to parse?

Try with any URL that's not a RSS feed. I assumed when I wrote the code that, if an URL which is not a rss feed should return an error encapsulated in the callback, but instead, I do got an error but it doesn't like like it's coming in the "err" variable.

Gotcha. Thanks for finding that! Ill have a fix in soon.

v0.1.4 should contain a fix for this issue. You can expect an error object to be returned in the callback.

That's right. It's working now. Thank you from Chile! :)