Sha256: 600d9812116cbbb0dd3e4f3ba75893b64782f48802008e799fb16eb2b0adee65

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 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 given URL couldn't be parsed
  class InvalidUrl < Error; end

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

  # raised when the requested resource has not been modified
  class NotModified < Error; end

  # raised when response returned 4xx or 5xx response
  class ResponseError < Error
    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 404 response
  class NotFound < ClientError; end

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

  # raised when there was an error connecting to the server
  class ConnectionError < Error; 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 < Error; end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
down-5.4.2 lib/down/errors.rb
down-5.4.1 lib/down/errors.rb
down-5.4.0 lib/down/errors.rb
down-5.3.1 lib/down/errors.rb
down-5.3.0 lib/down/errors.rb
down-5.2.4 lib/down/errors.rb
down-5.2.3 lib/down/errors.rb
down-5.2.2 lib/down/errors.rb
down-5.2.1 lib/down/errors.rb