Class: Twitter::Error

### Home Classes Methods

### In Files

- lib/twitter/error/already_favorited.rb
- lib/twitter/error/already_retweeted.rb
- lib/twitter/error/bad_gateway.rb
- lib/twitter/error/bad_request.rb
- lib/twitter/error/client_error.rb
- lib/twitter/error/configuration_error.rb
- lib/twitter/error/decode_error.rb
- lib/twitter/error/forbidden.rb
- lib/twitter/error/gateway_timeout.rb
- lib/twitter/error/identity_map_key_error.rb
- lib/twitter/error/internal_server_error.rb
- lib/twitter/error/not_acceptable.rb
- lib/twitter/error/not_found.rb
- lib/twitter/error/server_error.rb
- lib/twitter/error/service_unavailable.rb
- lib/twitter/error/too_many_requests.rb
- lib/twitter/error/unauthorized.rb
- lib/twitter/error/unprocessable_entity.rb
- lib/twitter/error.rb

### Parent

StandardError

### Namespace

- CLASS Twitter::Error::AlreadyFavorited
- CLASS Twitter::Error::AlreadyRetweeted
- CLASS Twitter::Error::BadGateway
- CLASS Twitter::Error::BadRequest
- CLASS Twitter::Error::ClientError
- CLASS Twitter::Error::ConfigurationError
- CLASS Twitter::Error::DecodeError
- CLASS Twitter::Error::EnhanceYourCalm
- CLASS Twitter::Error::Forbidden
- CLASS Twitter::Error::GatewayTimeout
- CLASS Twitter::Error::IdentityMapKeyError
- CLASS Twitter::Error::InternalServerError
- CLASS Twitter::Error::NotAcceptable
- CLASS Twitter::Error::NotFound
- CLASS Twitter::Error::RateLimited
- CLASS Twitter::Error::ServerError
- CLASS Twitter::Error::ServiceUnavailable
- CLASS Twitter::Error::TooManyRequests
- CLASS Twitter::Error::Unauthorized
- CLASS Twitter::Error::UnprocessableEntity

### Methods

- ::descendants
- ::errors
- ::new
- #backtrace

### Class/Module Index

Quicksearch

- Twitter
- Twitter::API
- Twitter::API::Arguments
- Twitter::API::DirectMessages
- Twitter::API::Favorites
- Twitter::API::FriendsAndFollowers
- Twitter::API::Help
- Twitter::API::Lists
- Twitter::API::PlacesAndGeo
- Twitter::API::SavedSearches
- Twitter::API::Search
- Twitter::API::SpamReporting
- Twitter::API::SuggestedUsers
- Twitter::API::Timelines
- Twitter::API::Trends
- Twitter::API::Tweets
- Twitter::API::Undocumented
- Twitter::API::Users
- Twitter::API::Utils
- Twitter::Action
- Twitter::Action::Favorite
- Twitter::Action::Follow
- Twitter::Action::ListMemberAdded
- Twitter::Action::Mention
- Twitter::Action::Reply
- Twitter::Action::Retweet
- Twitter::Action::Status
- Twitter::Action::Tweet
- Twitter::ActionFactory
- Twitter::Base
- Twitter::BasicUser
- Twitter::Client
- Twitter::Configurable
- Twitter::Configuration
- Twitter::Creatable
- Twitter::Cursor
- Twitter::Default
- Twitter::DirectMessage
- Twitter::Entity
- Twitter::Entity::Hashtag
- Twitter::Entity::Url
- Twitter::Entity::UserMention
- Twitter::Error
- Twitter::Error::AlreadyFavorited
- Twitter::Error::AlreadyRetweeted
- Twitter::Error::BadGateway
- Twitter::Error::BadRequest
- Twitter::Error::ClientError
- Twitter::Error::ConfigurationError
- Twitter::Error::DecodeError
- Twitter::Error::EnhanceYourCalm
- Twitter::Error::Forbidden
- Twitter::Error::GatewayTimeout
- Twitter::Error::IdentityMapKeyError
- Twitter::Error::InternalServerError
- Twitter::Error::NotAcceptable
- Twitter::Error::NotFound
- Twitter::Error::RateLimited
- Twitter::Error::ServerError
- Twitter::Error::ServiceUnavailable
- Twitter::Error::TooManyRequests
- Twitter::Error::Unauthorized
- Twitter::Error::UnprocessableEntity
- Twitter::Exceptable
- Twitter::Factory
- Twitter::Geo
- Twitter::Geo::Point
- Twitter::Geo::Polygon
- Twitter::GeoFactory
- Twitter::Identity
- Twitter::IdentityMap
- Twitter::Language
- Twitter::List
- Twitter::Media
- Twitter::Media::Photo
- Twitter::MediaFactory
- Twitter::Metadata
- Twitter::OEmbed
- Twitter::Place
- Twitter::ProfileBanner
- Twitter::RateLimit
- Twitter::Relationship
- Twitter::Request
- Twitter::Request::MultipartWithFile
- Twitter::Response
- Twitter::Response::ParseJson
- Twitter::Response::RaiseError
- Twitter::SavedSearch
- Twitter::SearchResults
- Twitter::Settings
- Twitter::Size
- Twitter::SourceUser
- Twitter::Status
- Twitter::Suggestion
- Twitter::TargetUser
- Twitter::Trend
- Twitter::Tweet
- Twitter::User
- Twitter::Version
- Enumerable
- Kernel

No matching classes.

# Twitter::Error

Custom error class for rescuing from all Twitter errors

### Constants

EnhanceYourCalm
RateLimited

### Attributes

rate_limit[R]
wrapped_exception[R]

### Public Class Methods

descendants() click to toggle source

@return [Array]

    # File lib/twitter/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/twitter/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 [Twitter::Error]

    # File lib/twitter/error.rb, line 21
    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 27
    def backtrace
      @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.