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, InitializationError, ParsingError, 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 = nil, response = nil) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #response_body ⇒ Object
- #response_headers ⇒ Object
- #response_status ⇒ Object
Constructor Details
#initialize(exc = nil, response = nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 |
# File 'lib/faraday/error.rb', line 9 def initialize(exc = nil, 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
43 44 45 46 47 |
# File 'lib/faraday/error.rb', line 43 def response_body return unless @response @response.is_a?(Faraday::Response) ? @response.body : @response[:body] end |