Sha256: 8ed139ae1fb41d8c479da03aa9eed4ab4c125740f562fc388769f54457082017

Contents?: true

Size: 413 Bytes

Versions: 2

Compression:

Stored size: 413 Bytes

Contents

class UrlReader::ReadError < UrlReader::BaseError
  PageNotFound = 0
  RequestTimeout = 1
  UnidentifiedError = 2

  attr_reader :type

  def initialize(*args)
    super(*args)
    inner = args[0]
    @type =
      if inner.is_a?(RestClient::ResourceNotFound)
        PageNotFound
      elsif inner.is_a?(RestClient::RequestTimeout)
        RequestTimeout
      else
        UnidentifiedError
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
url_reader-0.2.0 lib/url_reader/read_error.rb
url_reader-0.1.0 lib/url_reader/read_error.rb