ActiveResource: Response message is always empty when a exception is raised #4927

restebanez opened this Issue Feb 7, 2012 · 2 comments

2 participants


When ActiveResource throws an exception, it shows something like this:
ActiveResource::ResourceInvalid: Failed. Response code = 422. Response message = .

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)
Ruby on Rails member

Hey @restebanez

are you still getting this issue. ?? Or this can be closed?? Just want to follow up with this issue.

Ruby on Rails member

Closing this. Please reopen if issue still exists!


@arunagw arunagw closed this Apr 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment