multi_xml icon indicating copy to clipboard operation
multi_xml copied to clipboard

Make parsing errors inspectable

Open grosser opened this issue 12 years ago • 1 comments

When parsing fails I get something like:

/Users/mgrosser/.rvm/gems/ruby-1.9.3-p194/gems/multi_xml-0.5.1/lib/multi_xml/parsers/nokogiri.rb:16:in `parse': Opening and ending tag mismatch: meta line 4 and head (Faraday::Error::ParsingError)
    from /Users/mgrosser/.rvm/gems/ruby-1.9.3-p194/gems/multi_xml-0.5.1/lib/multi_xml.rb:119:in `parse'
    from /Users/mgrosser/.rvm/gems/ruby-1.9.3-p194/gems/faraday_middleware-0.8.7/lib/faraday_middleware/response/parse_xml.rb:9:in `block in <class:ParseXml>'
    from /Users/mgrosser/.rvm/gems/ruby-1.9.3-p194/gems/faraday_middleware-0.8.7/lib/faraday_middleware/response_middleware.rb:48:in `call'

which is pretty hard to debug, so how about raising a MultiXml::ParsingError that has .original_exception and .xml so the cause is easy to inspect

grosser avatar Sep 24 '12 18:09 grosser

I'd be open to a patch that makes this change.

sferik avatar Sep 24 '12 19:09 sferik