Sha256: c8592c018141871bed07ac74fa4387a4e772ead6c3d3111b45fa97ed864bfe2a

Contents?: true

Size: 1.44 KB

Versions: 43

Compression:

Stored size: 1.44 KB

Contents

module Faraday
  class Error < StandardError; end

  class ClientError < Error
    attr_reader :response, :wrapped_exception

    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 backtrace
      if @wrapped_exception
        @wrapped_exception.backtrace
      else
        super
      end
    end

    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
  end

  class ConnectionFailed < ClientError;   end
  class ResourceNotFound < ClientError;   end
  class ParsingError     < ClientError;   end

  class TimeoutError < ClientError
    def initialize(ex = nil)
      super(ex || "timeout")
    end
  end

  class SSLError < ClientError
  end

  class RetriableResponse < ClientError; end

  [:ClientError, :ConnectionFailed, :ResourceNotFound,
   :ParsingError, :TimeoutError, :SSLError, :RetriableResponse].each do |const|
    Error.const_set(const, Faraday.const_get(const))
  end


end

Version data entries

43 entries across 41 versions & 4 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/faraday-0.17.0/lib/faraday/error.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/faraday-0.15.4/lib/faraday/error.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/faraday-0.17.0/lib/faraday/error.rb
faraday-0.17.0 lib/faraday/error.rb
tdiary-5.0.13 vendor/bundle/gems/faraday-0.15.4/lib/faraday/error.rb
tdiary-5.0.12.1 vendor/bundle/gems/faraday-0.15.4/lib/faraday/error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.2/lib/faraday/error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.4/lib/faraday/error.rb
tdiary-5.0.11 vendor/bundle/gems/faraday-0.15.3/lib/faraday/error.rb
faraday-0.15.4 lib/faraday/error.rb
faraday-0.15.3 lib/faraday/error.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/faraday-0.15.2/lib/faraday/error.rb
tdiary-5.0.9 vendor/bundle/gems/faraday-0.15.1/lib/faraday/error.rb