Exception: Twitter::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Twitter::Error
- Defined in:
- lib/twitter/error.rb,
lib/twitter/error/forbidden.rb,
lib/twitter/error/not_found.rb,
lib/twitter/error/bad_gateway.rb,
lib/twitter/error/bad_request.rb,
lib/twitter/error/client_error.rb,
lib/twitter/error/decode_error.rb,
lib/twitter/error/rate_limited.rb,
lib/twitter/error/server_error.rb,
lib/twitter/error/unauthorized.rb,
lib/twitter/error/not_acceptable.rb,
lib/twitter/error/gateway_timeout.rb,
lib/twitter/error/service_unavailable.rb,
lib/twitter/error/internal_server_error.rb,
lib/twitter/error/identity_map_key_error.rb
Overview
Custom error class for rescuing from all Twitter errors
Direct Known Subclasses
Defined Under Namespace
Classes: BadGateway, BadRequest, ClientError, DecodeError, Forbidden, GatewayTimeout, IdentityMapKeyError, InternalServerError, NotAcceptable, NotFound, RateLimited, ServerError, ServiceUnavailable, Unauthorized
Constant Summary collapse
- EnhanceYourCalm =
RateLimited
Instance Attribute Summary collapse
-
#rate_limit ⇒ Object
readonly
Returns the value of attribute rate_limit.
-
#wrapped_exception ⇒ Object
readonly
Returns the value of attribute wrapped_exception.
Class Method Summary collapse
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(exception = $!, response_headers = {}) ⇒ Twitter::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(exception = $!, response_headers = {}) ⇒ Twitter::Error
Initializes a new Error object
23 24 25 26 27 |
# 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.) : super(exception.to_s) end |
Instance Attribute Details
#rate_limit ⇒ Object (readonly)
Returns the value of attribute rate_limit.
6 7 8 |
# File 'lib/twitter/error.rb', line 6 def rate_limit @rate_limit end |
#wrapped_exception ⇒ Object (readonly)
Returns the value of attribute wrapped_exception.
6 7 8 |
# File 'lib/twitter/error.rb', line 6 def wrapped_exception @wrapped_exception end |
Class Method Details
.descendants ⇒ Array
14 15 16 |
# File 'lib/twitter/error.rb', line 14 def self.descendants ObjectSpace.each_object(::Class).select{|klass| klass < self} end |
Instance Method Details
#backtrace ⇒ Object
29 30 31 |
# File 'lib/twitter/error.rb', line 29 def backtrace @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super end |