Parent

Class/Module Index [+]

Quicksearch

Twitter::Error

Custom error class for rescuing from all Twitter errors

Attributes

rate_limit[R]
wrapped_exception[R]

Public Class Methods

descendants() click to toggle source

@return [Array]

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

@return [Hash]

# File lib/twitter/error.rb, line 9
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 [Twitter::Error]

# File lib/twitter/error.rb, line 23
def initialize(exception=$!, response_headers={})
  @rate_limit = Twitter::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
# File lib/twitter/error.rb, line 29
def backtrace
  @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.