Sha256: bd50ac1718e5cc8bbc2ace66d2953e0685ccf314394ad94a91c7962d9b04e933

Contents?: true

Size: 945 Bytes

Versions: 12

Compression:

Stored size: 945 Bytes

Contents

module Faraday
  module Error
    class ClientError < StandardError
      attr_reader :response

      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
        %(#<#{self.class}>)
      end
    end

    class ConnectionFailed < ClientError;   end
    class ResourceNotFound < ClientError;   end
    class ParsingError     < ClientError;   end
    class TimeoutError < ClientError; end
    class MissingDependency < StandardError; end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
faraday-0.8.8 lib/faraday/error.rb
faraday-0.8.7 lib/faraday/error.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/faraday-0.8.6/lib/faraday/error.rb
faraday-0.8.6 lib/faraday/error.rb
faraday-0.8.5 lib/faraday/error.rb
faraday-0.8.4 lib/faraday/error.rb
faraday-0.8.2 lib/faraday/error.rb
avdi-faraday-0.8.1 lib/faraday/error.rb
faraday-0.8.1 lib/faraday/error.rb
faraday-0.8.0 lib/faraday/error.rb
faraday-0.8.0.rc2 lib/faraday/error.rb
faraday-0.7.6 lib/faraday/error.rb