Exception: Faraday::Error::ClientError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/faraday/error.rb

Direct Known Subclasses

ConnectionFailed, ParsingError, ResourceNotFound

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ClientError) initialize(ex)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/faraday/error.rb', line 6

def initialize(ex)
  @wrapped_exception = nil
  @response = nil

  if ex.respond_to?(:backtrace)
    super(ex.message)
    @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

- (Object) response (readonly)

Returns the value of attribute response



4
5
6
# File 'lib/faraday/error.rb', line 4

def response
  @response
end

Instance Method Details

- (Object) backtrace



21
22
23
24
25
26
27
# File 'lib/faraday/error.rb', line 21

def backtrace
  if @wrapped_exception
    @wrapped_exception.backtrace
  else
    super
  end
end

- (Object) inspect



29
30
31
# File 'lib/faraday/error.rb', line 29

def inspect
  %(#<#{self.class}>)
end