Exception: Faraday::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Faraday::Error
show all
- Defined in:
- lib/faraday/error.rb
Overview
Faraday error base class.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(exc = nil, response = nil) ⇒ 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
Returns the value of attribute response.
7
8
9
|
# File 'lib/faraday/error.rb', line 7
def response
@response
end
|
#wrapped_exception ⇒ Object
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
|
37
38
39
40
41
|
# File 'lib/faraday/error.rb', line 37
def
return unless @response
@response.is_a?(Faraday::Response) ? @response. : @response[:headers]
end
|
#response_status ⇒ Object
31
32
33
34
35
|
# File 'lib/faraday/error.rb', line 31
def response_status
return unless @response
@response.is_a?(Faraday::Response) ? @response.status : @response[:status]
end
|