Sha256: a76713bbedc5435e9a40f665f8e39ed9fee7da52b00b0bbb7fdb6dfbcad3724c

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

require "net_http_timeout_errors/version"
require "net/http"

class NetHttpTimeoutError < StandardError
  attr_reader :original_error

  def initialize(original_error)
    @original_error = original_error
  end
end

class NetHttpTimeoutErrors
  def self.all
    [
      EOFError,
      Errno::ECONNREFUSED,
      Errno::ECONNRESET,
      Errno::EHOSTUNREACH,
      Errno::EINVAL,
      Errno::ENETUNREACH,
      Errno::EPIPE,
      Errno::ETIMEDOUT,
      Net::HTTPBadResponse,
      Net::HTTPHeaderSyntaxError,
      Net::ProtocolError,
      SocketError,
      Timeout::Error,
    ]
  end

  def self.conflate
    yield
  rescue *all => e
    raise NetHttpTimeoutError.new(e)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
net_http_timeout_errors-0.3.0 lib/net_http_timeout_errors.rb