class Faraday::ClientError

def backtrace

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

def initialize(ex, response = nil)

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

def inspect

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