Exception: Faraday::ClientError
- Defined in:
- lib/faraday/error.rb
Direct Known Subclasses
ConnectionFailed, ParsingError, ResourceNotFound, RetriableResponse, SSLError, TimeoutError
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(ex, response = nil) ⇒ ClientError
constructor
A new instance of ClientError.
- #inspect ⇒ Object
Constructor Details
#initialize(ex, response = nil) ⇒ ClientError
Returns a new instance of ClientError.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/faraday/error.rb', line 7 def initialize(ex, response = nil) @wrapped_exception = nil @response = response if ex.respond_to?(:backtrace) super(ex.) @wrapped_exception = ex elsif ex.respond_to?(:each_key) super("the server responded with status #{ex[:status]}") @response = ex else super(ex.to_s) end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/faraday/error.rb', line 5 def response @response end |
#wrapped_exception ⇒ Object (readonly)
Returns the value of attribute wrapped_exception.
5 6 7 |
# File 'lib/faraday/error.rb', line 5 def wrapped_exception @wrapped_exception end |
Instance Method Details
#backtrace ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/faraday/error.rb', line 22 def backtrace if @wrapped_exception @wrapped_exception.backtrace else super end end |
#inspect ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/faraday/error.rb', line 30 def inspect inner = '' if @wrapped_exception inner << " wrapped=#{@wrapped_exception.inspect}" end if @response inner << " response=#{@response.inspect}" end if inner.empty? inner << " #{super}" end %(#<#{self.class}#{inner}>) end |