From 15b32e0ee318b961ac09af0217910c97ee8cd9a8 Mon Sep 17 00:00:00 2001 From: Ewout Stam Date: Fri, 16 Dec 2011 18:42:31 +0100 Subject: [PATCH] You can now call .to_s on the Error class to get back the response's content. This content is now logged whenever the server returns an error. --- lib/grid_rest.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/grid_rest.rb b/lib/grid_rest.rb index 2834f17..f169357 100644 --- a/lib/grid_rest.rb +++ b/lib/grid_rest.rb @@ -239,7 +239,7 @@ def r.valid? grid_rest_log method, rest_url, rparams, "connection refused response" rescue => e r = Error.new e, :url => rest_url, :method => method - grid_rest_log method, rest_url, rparams, "error in request" + grid_rest_log method, rest_url, rparams, "error in request: " + r.to_s end r end @@ -304,9 +304,12 @@ def initialize(e, rparams) def code @code || 500 end + + # Return the content of the request, so you can use it for debugging. def to_s - '' + @response.to_s end + alias to_str to_s def valid?