rails/rails — Issue #4927: ActiveResource: Response message is always empty when a exception is raised
Author: restebanez
Created: 2012-02-07 17:36:36+00:00
State: open

Hi,
When ActiveResource throws an exception, it shows something like this:
#

The content of Response message is always ".>". A more meaningful message would be to include the body (that usually contains the error message in whatever format)

I think an easy and useful solution is to add an extra line with the response.body to ActiveResource::ConnectionError, to_s method:

class ActiveResource::ConnectionError
def to_s
message = "Failed."
message << " Response code = #{response.code}." if response.respond_to?(:code)
message << " Response message = #{response.message}." if response.respond_to?(:message)
message << " Response body = #{response.body}." if response.respond_to?(:body)
message
end
end