class Echowrap::Error
Custom error class for rescuing from all Echowrap
errors
Constants
Attributes
rate_limit[R]
wrapped_exception[R]
Public Class Methods
descendants()
click to toggle source
@return [Array]
# File lib/echowrap/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/echowrap/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 [Echowrap::Error]
Calls superclass method
# File lib/echowrap/error.rb, line 21 def initialize(exception=$!, response_headers={}) @rate_limit = Echowrap::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/echowrap/error.rb, line 27 def backtrace @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super end