module Ant::Exceptions::HTTP

Provides basic execptions for http common errors.

Constants

EXCEPTION_TYPES

Public Class Methods

initialize(message, object = {}) click to toggle source
Calls superclass method
# File lib/ant/http_exceptions.rb, line 19
def initialize(message, object = {})
  super(message, nil, object)
end
new_http_exception(class_name, http_code, type) click to toggle source
# File lib/ant/http_exceptions.rb, line 16
def new_http_exception(class_name, http_code, type)
  parent = exception_type(type)
  http_exception_class = Class.new(parent) do
    def initialize(message, object = {})
      super(message, nil, object)
    end

    define_method 'http_code' do
      http_code
    end
  end

  const_set(class_name, http_exception_class)
end

Private Class Methods

exception_type(type) click to toggle source
# File lib/ant/http_exceptions.rb, line 33
def exception_type(type)
  EXCEPTION_TYPES[type.to_sym]
end