Skip to content
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

Force error during parsing #261

Closed
farski opened this issue Jan 25, 2015 · 4 comments
Closed

Force error during parsing #261

farski opened this issue Jan 25, 2015 · 4 comments

Comments

@farski
Copy link

farski commented Jan 25, 2015

I'm trying to make sure I'm handling parse errors properly, but I can't seem to get the error to happen. I either raise a NoParserAvailable exception, or it parses as best it can but doesn't call the error block. Do you have any example data that will cause a parsing error? I looked through the tests, but didn't see anything.

@jonallured
Copy link
Contributor

Hi @farski - I'm not 100% sure I understand your question, so let me know if this isn't what you were wondering...

I think there's a couple things going on here that I'd like to clarify.

The first is that I'm not happy at all with the callbacks in Feedjira and I'm actually moving away from them anyway. If you check out the faraday branch, you'll see that I've replaced curb with faraday and that let me restructure things so that exceptions bubble as expected and callbacks are no longer necessary.

The other part of your question - do I have data that will cause a parsing error other than NoParserAvailable. I actually don't know of any. I'm not even sure what else you could get - Nokogiri is really good at parsing "broken" XML.

Anyway, hope that helps and let me know if you have any further questions!

Jon

@farski
Copy link
Author

farski commented Feb 10, 2015

So the block that gets passed to Feed.parse can/will never get called?

@jonallured
Copy link
Contributor

Yes, this is my criticism of the callback technique. There are situations where a user will assume their callback will fire and it doesn't. I much prefer the straightforwardness of rescuing exceptions.

@jonallured
Copy link
Contributor

Hi @farski, I'm going to go ahead and close this one - let me know if you need anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants