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&g开发者_开发技巧t;
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?
Apparently this is a known problem. One solution could be http://github.com/kares/request_exception_handler
精彩评论