I have a REST API which accepts XML in HTTP Posts.
When I send wellformed XML, the XML is parsed and put in the params object. For instance:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<foo>
<bar>Hello</bar>
</foo>
is available as: "foo"=>{"bar"=>"Hello"}}
But when I send malformed XML, Rails logs a REXML::ParseException and returns the HTML for this "Something went wrong"-site.
How can I catch this Exception so that I can respond with something more useful?