Skip to content
Browse files

Garb::*Error.to_s for a bit more clarity of what's happenin'

  • Loading branch information...
1 parent 3357792 commit c30e04511488aec3bb977cf144a7d1212c5774e0 Sijawusz Pur Rahnama committed May 17, 2012
Showing with 7 additions and 3 deletions.
  1. +2 −2 lib/garb/report_response.rb
  2. +5 −1 lib/garb/request/data.rb
View
4 lib/garb/report_response.rb
@@ -16,11 +16,11 @@ def results
end
def total_results
- data[:total_results].to_i
+ data[:total_results]
end
def sampled?
- data[:contains_sampled_data] != 'false'
+ data[:contains_sampled_data]
end
private
View
6 lib/garb/request/data.rb
@@ -5,6 +5,10 @@ class ClientError < StandardError
def initialize(message, code = nil, errors = [])
@code, @message, @errors = code, message, errors
end
+
+ def to_s
+ code ? "[#{code}] #{message}" : message
+ end
end
class BadRequestError < ClientError; end
class InvalidCredentialsError < ClientError; end
@@ -35,7 +39,7 @@ def uri
end
def send_request
- if defined?(Rails) and Rails.env == 'development'
+ if defined?(Rails)
Rails.logger.try :debug, "Garb::Request -> #{uri.path}#{query_string}"
end

0 comments on commit c30e045

Please sign in to comment.
Something went wrong with that request. Please try again.