Sha256: 93a9c3562c297f748bcbe2111311858e2d68ade4e37ff3e3c95daea9b1698505

Contents?: true

Size: 650 Bytes

Versions: 9

Compression:

Stored size: 650 Bytes

Contents

class UrlFetcher

  class Error < StandardError ; end

  class TooManyRedirects < Error
    attr_reader :url, :max_attempts
    def initialize(url, max_attempts)
      @url, @max_attempts = url, max_attempts
    end

    def to_s
      "#{url} has too many redirects (over #{max_attempts})."
    end
  end

  class FileTooBig < Error
    attr_reader :size
    def initialize(size)
      @size = size
    end
    
    def to_s
      "File too big (#{size} bytes)"
    end
  end

  class CircularRedirect < Error
    attr_reader :url

    def initialize(url)
      @url = url
    end

    def to_s
      "#{url} has a redirect loop."
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
url_fetcher-1.1.7 lib/url_fetcher/errors.rb
url_fetcher-1.1.6 lib/url_fetcher/errors.rb
url_fetcher-1.1.5 lib/url_fetcher/errors.rb
url_fetcher-1.1.4 lib/url_fetcher/errors.rb
url_fetcher-1.1.3 lib/url_fetcher/errors.rb
url_fetcher-1.1.2 lib/url_fetcher/errors.rb
url_fetcher-1.1.1 lib/url_fetcher/errors.rb
url_fetcher-1.1.0 lib/url_fetcher/errors.rb
url_fetcher-1.0.3 lib/url_fetcher/errors.rb