Exception: Faraday::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Faraday::Error
- Defined in:
- lib/faraday/error.rb
Overview
Faraday error base class.
Direct Known Subclasses
ClientError, ConnectionFailed, ParsingError, RetriableResponse, SSLError, ServerError
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#wrapped_exception ⇒ Object
readonly
Returns the value of attribute wrapped_exception.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(exc, response = nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #response_body ⇒ Object
- #response_headers ⇒ Object
- #response_status ⇒ Object
Constructor Details
#initialize(exc, response = nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 |
# File 'lib/faraday/error.rb', line 9 def initialize(exc, response = nil) @wrapped_exception = nil unless defined?(@wrapped_exception) @response = nil unless defined?(@response) super(exc_msg_and_response!(exc, response)) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/faraday/error.rb', line 7 def response @response end |
#wrapped_exception ⇒ Object (readonly)
Returns the value of attribute wrapped_exception.
7 8 9 |
# File 'lib/faraday/error.rb', line 7 def wrapped_exception @wrapped_exception end |
Instance Method Details
#backtrace ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/faraday/error.rb', line 15 def backtrace if @wrapped_exception @wrapped_exception.backtrace else super end end |
#inspect ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/faraday/error.rb', line 23 def inspect inner = +'' inner << " wrapped=#{@wrapped_exception.inspect}" if @wrapped_exception inner << " response=#{@response.inspect}" if @response inner << " #{super}" if inner.empty? %(#<#{self.class}#{inner}>) end |
#response_body ⇒ Object
39 40 41 |
# File 'lib/faraday/error.rb', line 39 def response_body @response[:body] if @response end |
#response_headers ⇒ Object
35 36 37 |
# File 'lib/faraday/error.rb', line 35 def response_headers @response[:headers] if @response end |
#response_status ⇒ Object
31 32 33 |
# File 'lib/faraday/error.rb', line 31 def response_status @response[:status] if @response end |