lib/bugsnag/api/error.rb in bugsnag-api-1.0.0 vs lib/bugsnag/api/error.rb in bugsnag-api-1.0.1
- old
+ new
@@ -34,11 +34,11 @@
end
end
def initialize(response=nil)
@response = response
- super(response_error)
+ super(build_error_message)
end
private
def data
@@ -57,9 +57,19 @@
end
end
def response_error
"Error: #{data[:error]}" if data.is_a?(Hash) && data[:error]
+ end
+
+ def build_error_message
+ return nil if @response.nil?
+
+ message = "#{@response[:method].to_s.upcase} "
+ message << @response[:url].to_s + ": "
+ message << "#{@response[:status]} - "
+ message << "#{response_error}" unless response_error.nil?
+ message
end
end
# Raised on errors in the 400-499 range
class ClientError < Error; end