Sha256: 8032d46a90df4081172c6da4a8014a38c435e73ae22f9136031ed28b63f4a2ed

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

require 'hackeroo/error'

module Hackeroo
  class Error
    # Raised when Hackeroo returns a 5xx HTTP status code
    class ServerError < Hackeroo::Error
      MESSAGE = "Server Error"

      # Create a new error from an HTTP environment
      #
      # @param response [Hash]
      # @return [Hackeroo::Error]
      def self.from_response(response={})
        new(nil, response[:response_headers])
      end

      # Initializes a new ServerError object
      #
      # @param message [String]
      # @param response_headers [Hash]
      # @return [Hackeroo::Error::ServerError]
      def initialize(message=nil, response_headers={})
        super((message || self.class.const_get(:MESSAGE)), response_headers)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackeroo-0.1.0 lib/hackeroo/error/server_error.rb