Sha256: 46ac3f0ca55cd16c88f49b65a5ed7e2f7281f3da3c25d49e79d9fa0fbf8810c5

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module Down
  # generic error which is a superclass to all other errors
  class Error < StandardError; end

  # raised when the file is larger than the specified maximum size
  class TooLarge < Error; end

  # raised when the file failed to be retrieved for whatever reason
  class NotFound < Error; end

  # raised when the given URL couldn't be parsed
  class InvalidUrl < NotFound; end

  # raised when the number of redirects was larger than the specified maximum
  class TooManyRedirects < NotFound; end

  # raised when response returned 4xx or 5xx response
  class ResponseError < NotFound
    attr_reader :response

    def initialize(message, response:)
      super(message)
      @response = response
    end
  end

  # raised when response returned 4xx response
  class ClientError < ResponseError; end

  # raised when response returned 5xx response
  class ServerError < ResponseError; end

  # raised when there was an error connecting to the server
  class ConnectionError < NotFound; end

  # raised when connecting to the server too longer than the specified timeout
  class TimeoutError < ConnectionError; end

  # raised when an SSL error was raised
  class SSLError < NotFound; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
down-3.2.0 lib/down/errors.rb
down-3.1.0 lib/down/errors.rb