Sha256: d965f429f56f87b2853540e2f49fa52e2fe51fe44a0666e9b0c08197be4e2d8d

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

module SimpleHelper
  class Error < StandardError; end

  # Exception raised when you attempt to set a non-existent format
  class UnsupportedFormat < Error; end

  # Exception raised when using a URI scheme other than HTTP or HTTPS
  class UnsupportedURIScheme < Error; end

  # @abstract Exceptions which inherit from ResponseError contain the Net::HTTP
  # response object accessible via the {#response} method.
  class ResponseError < Error
    # Returns the response of the last request
    # @return [Net::HTTPResponse] A subclass of Net::HTTPResponse, e.g.
    # Net::HTTPOK
    attr_reader :response

    # Instantiate an instance of ResponseError with a Net::HTTPResponse object
    # @param [Net::HTTPResponse]
    def initialize(response)
      @response = response
      super(response)
    end
  end

  # Exception that is raised when request has redirected too many times.
  # Calling {#response} returns the Net:HTTP response object.
  class RedirectionTooDeep < ResponseError; end

  # Exception that is raised when request redirects and location header is present more than once
  class DuplicateLocationHeader < ResponseError; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_request-0.1.5 lib/simple_helper/exceptions.rb
simple_request-0.1.4 lib/simple_helper/exceptions.rb
simple_request-0.1.3 lib/simple_helper/exceptions.rb
simple_request-0.1.2 lib/simple_helper/exceptions.rb
simple_request-0.1.1 lib/simple_helper/exceptions.rb