StandardError
Custom error class for rescuing from all Twitter errors
@return [Hash]
# File lib/twitter/error.rb, line 44 def errors @errors ||= descendants.reduce({}) do |hash, klass| hash[klass::HTTP_STATUS_CODE] = klass hash end end
Create a new error from an HTTP response
@param response [Hash] @return [Twitter::Error]
# File lib/twitter/error.rb, line 38 def from_response(response = {}) error, code = parse_error(response[:body]) new(error, response[:response_headers], code) end
Initializes a new Error object
@param exception [Exception, String] @param response_headers [Hash] @param code [Integer] @return [Twitter::Error]
# File lib/twitter/error.rb, line 79 def initialize(exception = $ERROR_INFO, response_headers = {}, code = nil) @rate_limit = RateLimit.new(response_headers) @cause = exception @code = code exception.respond_to?(:message) ? super(exception.message) : super(exception.to_s) end
Generated with the Darkfish Rdoc Generator 2.