lib/google/apis/errors.rb in google-api-client-0.9.pre1 vs lib/google/apis/errors.rb in google-api-client-0.9.pre2
- old
+ new
@@ -14,29 +14,36 @@
module Google
module Apis
# Base error, capable of wrapping another
class Error < StandardError
- def initialize(err)
+ attr_reader :status_code
+ attr_reader :header
+ attr_reader :body
+
+ def initialize(err, status_code: nil, header: nil, body: nil)
@cause = nil
if err.respond_to?(:backtrace)
super(err.message)
@cause = err
else
super(err.to_s)
end
+ @status_code = status_code
+ @header = header.dup unless header.nil?
+ @body = body
end
def backtrace
if @cause
@cause.backtrace
else
super
end
end
end
-
+
# An error which is raised when there is an unexpected response or other
# transport error that prevents an operation from succeeding.
class TransmissionError < Error
end