class EmpireAvenue::Error

customer error class for any errors

Attributes

wrapped_exception[R]

Public Class Methods

descendants() click to toggle source

@return [Array]

# File lib/empireavenue/error.rb, line 12
def self.descendants
  ObjectSpace.each_object(::Class).select{|klass| klass < self}
end
errors() click to toggle source

@return [Hash]

# File lib/empireavenue/error.rb, line 7
def self.errors
  @errors ||= Hash[descendants.map{|klass| [klass.const_get(:HTTP_STATUS_CODE), klass]}]
end
new(exception=$!, response_headers={}) click to toggle source

Initializes a new Error object

@param exception [Exception, String] @param response_headers [Hash] @return [EmpireAvenue::Error]

Calls superclass method
# File lib/empireavenue/error.rb, line 21
def initialize(exception=$!, response_headers={})
  #@rate_limit = EmpireAvenue::RateLimit.new(response_headers)
  @wrapped_exception = exception
  exception.respond_to?(:backtrace) ? super(exception.message) : super(exception.to_s)
end

Public Instance Methods

backtrace() click to toggle source
Calls superclass method
# File lib/empireavenue/error.rb, line 27
def backtrace
  @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super
end