class Faraday::ClientError

Attributes

response[R]
wrapped_exception[R]

Public Class Methods

new(ex, response = nil) click to toggle source
Calls superclass method
# File lib/faraday/error.rb, line 8
def initialize(ex, response = nil)
  @wrapped_exception = nil
  @response = response

  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

Public Instance Methods

backtrace() click to toggle source
Calls superclass method
# File lib/faraday/error.rb, line 23
def backtrace
  if @wrapped_exception
    @wrapped_exception.backtrace
  else
    super
  end
end
inspect() click to toggle source
# File lib/faraday/error.rb, line 31
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
  %Q(#<#{self.class}#{inner}>)
end