-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to catch Sax errors? #109
Comments
When |
Regardless of whether I have var feedParser = new FeedParser({
addmeta: false,
feedurl: feedUrl,
resume_saxerror: true
});
feedParser.on('error', function () {
// This is called, but it does not *catch* the error.
console.log('feedParser error', arguments);
}); |
Bump. |
@OliverJAsh I'm working on refactoring SAX error handling, which I believe is actually a bit broken in sax. Still digging. Your code about doesn't have a parameter for the error handler. Are you sure it's being triggered by the error that gets thrown? Or that the "Unexpected end" error after you've already handled the other error, possibly. |
It is being triggered by the error that gets thrown because I am seeing the error logged to the console (I just log the |
However, it is immediately followed by the uncaught exception, from the same error. |
That sounds like the error is not getting cleared for some reason. If sax resumes parsing and the error has not been cleared, it will throw -- intentionally throw. I cannot reproduce this behavior, though. Can you post a gist or something with runnable code that does this so I can help you debug it? |
I have this problem when parsing http://theramblingtour.smugglersrecords.com/?feed=rss2 with the following code: feedParser
.on('error', function (error) {
// This should catch the error, but it doesn't.
})
.on('readable', function () {
this.end();
}); The error only occurs upon this feed when I call If you still can't reproduce it with that information, I’ll have a go at creating an isolated case in a gist for you. |
I did this: https://gist.github.com/danmactough/342c037d8094ce1a553d and cannot reproduce. |
Sometimes I get sax errors. How can I catch them?
I have kept
resume_saxerror
to its default value oftrue
.The text was updated successfully, but these errors were encountered: