Sha256: 5c602219a01c5e667d1b1cc8f16ce9ec9057db2a0ebf5b75810cb2f707b2e206

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

# frozen-string-literal: true

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: nil)
      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

14 entries across 14 versions & 1 rubygems

Version Path
down-4.8.1 lib/down/errors.rb
down-4.8.0 lib/down/errors.rb
down-4.7.0 lib/down/errors.rb
down-4.6.1 lib/down/errors.rb
down-4.6.0 lib/down/errors.rb
down-4.5.0 lib/down/errors.rb
down-4.4.0 lib/down/errors.rb
down-4.3.0 lib/down/errors.rb
down-4.2.1 lib/down/errors.rb
down-4.2.0 lib/down/errors.rb
down-4.1.1 lib/down/errors.rb
down-4.1.0 lib/down/errors.rb
down-4.0.1 lib/down/errors.rb
down-4.0.0 lib/down/errors.rb