Exception: Wayback::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Wayback::Error
- Defined in:
- lib/wayback/error.rb,
lib/wayback/error/forbidden.rb,
lib/wayback/error/not_found.rb,
lib/wayback/error/bad_gateway.rb,
lib/wayback/error/bad_request.rb,
lib/wayback/error/client_error.rb,
lib/wayback/error/decode_error.rb,
lib/wayback/error/server_error.rb,
lib/wayback/error/unauthorized.rb,
lib/wayback/error/not_acceptable.rb,
lib/wayback/error/gateway_timeout.rb,
lib/wayback/error/already_favorited.rb,
lib/wayback/error/already_retweeted.rb,
lib/wayback/error/too_many_requests.rb,
lib/wayback/error/configuration_error.rb,
lib/wayback/error/service_unavailable.rb,
lib/wayback/error/unprocessable_entity.rb,
lib/wayback/error/internal_server_error.rb,
lib/wayback/error/identity_map_key_error.rb
Overview
Custom error class for rescuing from all Wayback errors
Direct Known Subclasses
AlreadyFavorited, AlreadyRetweeted, ClientError, DecodeError, ServerError
Defined Under Namespace
Classes: AlreadyFavorited, AlreadyRetweeted, BadGateway, BadRequest, ClientError, ConfigurationError, DecodeError, Forbidden, GatewayTimeout, IdentityMapKeyError, InternalServerError, NotAcceptable, NotFound, ServerError, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity
Constant Summary collapse
- EnhanceYourCalm =
TooManyRequests
- RateLimited =
TooManyRequests
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 = $!, response_headers = {}) ⇒ Wayback::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(exception = $!, response_headers = {}) ⇒ Wayback::Error
Initializes a new Error object
21 22 23 24 |
# File 'lib/wayback/error.rb', line 21 def initialize(exception=$!, response_headers={}) @wrapped_exception = exception exception.respond_to?(:backtrace) ? super(exception.) : super(exception.to_s) end |
Instance Attribute Details
#wrapped_exception ⇒ Object (readonly)
Returns the value of attribute wrapped_exception.
4 5 6 |
# File 'lib/wayback/error.rb', line 4 def wrapped_exception @wrapped_exception end |
Class Method Details
.descendants ⇒ Array
12 13 14 |
# File 'lib/wayback/error.rb', line 12 def self.descendants ObjectSpace.each_object(::Class).select{|klass| klass < self} end |
.errors ⇒ Hash
7 8 9 |
# File 'lib/wayback/error.rb', line 7 def self.errors @errors ||= Hash[descendants.map{|klass| [klass.const_get(:HTTP_STATUS_CODE), klass]}] end |
Instance Method Details
#backtrace ⇒ Object
26 27 28 |
# File 'lib/wayback/error.rb', line 26 def backtrace @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super end |