Exception: Google::Apis::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Google::Apis::Error
- Defined in:
- lib/google/apis/errors.rb
Overview
Base error, capable of wrapping another
Direct Known Subclasses
AuthorizationError, BatchError, ClientError, ProjectNotLinkedError, RateLimitError, RedirectError, ServerError, TransmissionError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(err, status_code: nil, header: nil, body: nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
Constructor Details
#initialize(err, status_code: nil, header: nil, body: nil) ⇒ Error
Returns a new instance of Error
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/google/apis/errors.rb', line 23 def initialize(err, status_code: nil, header: nil, body: nil) @cause = nil if err.respond_to?(:backtrace) super(err.) @cause = err else super(err.to_s) end @status_code = status_code @header = header.dup unless header.nil? @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
21 22 23 |
# File 'lib/google/apis/errors.rb', line 21 def body @body end |
#header ⇒ Object (readonly)
Returns the value of attribute header
20 21 22 |
# File 'lib/google/apis/errors.rb', line 20 def header @header end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code
19 20 21 |
# File 'lib/google/apis/errors.rb', line 19 def status_code @status_code end |
Instance Method Details
#backtrace ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/google/apis/errors.rb', line 37 def backtrace if @cause @cause.backtrace else super end end |
#inspect ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/google/apis/errors.rb', line 45 def inspect extra = "" extra << " status_code: #{status_code.inspect}" unless status_code.nil? extra << " header: #{header.inspect}" unless header.nil? extra << " body: #{body.inspect}" unless body.nil? "#<#{self.class.name}: #{}#{extra}>" end |