Exception: ACTV::Error
- Inherits:
-
StandardError
- Object
- StandardError
- ACTV::Error
- Defined in:
- lib/actv/error.rb,
lib/actv/error/forbidden.rb,
lib/actv/error/not_found.rb,
lib/actv/error/bad_gateway.rb,
lib/actv/error/bad_request.rb,
lib/actv/error/client_error.rb,
lib/actv/error/server_error.rb,
lib/actv/error/unauthorized.rb,
lib/actv/error/not_acceptable.rb,
lib/actv/error/enhance_your_calm.rb,
lib/actv/error/service_unavailable.rb,
lib/actv/error/internal_server_error.rb
Overview
Custom error class for rescuing from all Twitter errors
Direct Known Subclasses
Defined Under Namespace
Classes: BadGateway, BadRequest, ClientError, EnhanceYourCalm, Forbidden, InternalServerError, NotAcceptable, NotFound, ServerError, ServiceUnavailable, Unauthorized
Instance Attribute Summary collapse
-
#wrapped_exception ⇒ Object
readonly
Returns the value of attribute wrapped_exception.
Class Method Summary collapse
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(exception = $!) ⇒ Twitter::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(exception = $!) ⇒ Twitter::Error
Initializes a new Error object
18 19 20 21 22 23 24 25 |
# File 'lib/actv/error.rb', line 18 def initialize(exception=$!) if exception.respond_to?(:backtrace) super(exception.) @wrapped_exception = exception else super(exception.to_s) end end |
Instance Attribute Details
#wrapped_exception ⇒ Object (readonly)
Returns the value of attribute wrapped_exception.
4 5 6 |
# File 'lib/actv/error.rb', line 4 def wrapped_exception @wrapped_exception end |
Class Method Details
.descendants ⇒ Object
10 11 12 |
# File 'lib/actv/error.rb', line 10 def self.descendants ObjectSpace.each_object(::Class).select{|klass| klass < self} end |
.errors ⇒ Object
6 7 8 |
# File 'lib/actv/error.rb', line 6 def self.errors @errors ||= Hash[descendants.map{|klass| [klass.const_get(:HTTP_STATUS_CODE), klass]}] end |
Instance Method Details
#backtrace ⇒ Object
27 28 29 |
# File 'lib/actv/error.rb', line 27 def backtrace @wrapped_exception ? @wrapped_exception.backtrace : super end |