Sha256: bdf5b572df424236f1f4804dee30b75507dbf38a98a941df90b78487993041e2

Contents?: true

Size: 524 Bytes

Versions: 5

Compression:

Stored size: 524 Bytes

Contents

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

  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
      elsif inner.is_a?(RestClient::InternalServerError)
        InternalServerError
      else
        UnidentifiedError
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
url_reader-0.2.5 lib/url_reader/read_error.rb
url_reader-0.2.4 lib/url_reader/read_error.rb
url_reader-0.2.3 lib/url_reader/read_error.rb
url_reader-0.2.2 lib/url_reader/read_error.rb
url_reader-0.2.1 lib/url_reader/read_error.rb