Sha256: 60a8c6b7ee1ccf6911ae714cf38a5712823b10e6ad3fd4ce569a7c9063ea87bf

Contents?: true

Size: 1.16 KB

Versions: 26

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module HTTPX
  class Error < StandardError; end

  class UnsupportedSchemeError < Error; end

  class TimeoutError < Error
    attr_reader :timeout

    def initialize(timeout, message)
      @timeout = timeout
      super(message)
    end

    def to_connection_error
      ex = ConnectTimeoutError.new(@timeout, message)
      ex.set_backtrace(backtrace)
      ex
    end
  end

  class TotalTimeoutError < TimeoutError; end

  class ConnectTimeoutError < TimeoutError; end

  class SettingsTimeoutError < TimeoutError; end

  class ResolveTimeoutError < TimeoutError; end

  class ResolveError < Error; end

  class NativeResolveError < ResolveError
    attr_reader :connection, :host

    def initialize(connection, host, message = "Can't resolve #{host}")
      @connection = connection
      @host = host
      super(message)
    end
  end

  class HTTPError < Error
    attr_reader :response

    def initialize(response)
      @response = response
      super("HTTP Error: #{@response.status} #{@response.headers}\n#{@response.body}")
    end

    def status
      @response.status
    end
  end

  class MisdirectedRequestError < HTTPError; end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
httpx-0.20.5 lib/httpx/errors.rb
httpx-0.20.4 lib/httpx/errors.rb
httpx-0.20.3 lib/httpx/errors.rb
httpx-0.20.2 lib/httpx/errors.rb
httpx-0.20.1 lib/httpx/errors.rb
httpx-0.20.0 lib/httpx/errors.rb
httpx-0.19.8 lib/httpx/errors.rb
httpx-0.19.7 lib/httpx/errors.rb
httpx-0.19.6 lib/httpx/errors.rb
httpx-0.19.5 lib/httpx/errors.rb
httpx-0.19.4 lib/httpx/errors.rb
httpx-0.19.3 lib/httpx/errors.rb
httpx-0.19.2 lib/httpx/errors.rb
httpx-0.19.1 lib/httpx/errors.rb
httpx-0.19.0 lib/httpx/errors.rb
httpx-0.18.7 lib/httpx/errors.rb
httpx-0.18.6 lib/httpx/errors.rb
httpx-0.18.5 lib/httpx/errors.rb
httpx-0.18.4 lib/httpx/errors.rb
httpx-0.18.3 lib/httpx/errors.rb