Exception: Tradier::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Tradier::Error
- Defined in:
- lib/tradier/error.rb,
lib/tradier/error/forbidden.rb,
lib/tradier/error/not_found.rb,
lib/tradier/error/bad_gateway.rb,
lib/tradier/error/bad_request.rb,
lib/tradier/error/client_error.rb,
lib/tradier/error/decode_error.rb,
lib/tradier/error/server_error.rb,
lib/tradier/error/unauthorized.rb,
lib/tradier/error/not_acceptable.rb,
lib/tradier/error/gateway_timeout.rb,
lib/tradier/error/too_many_requests.rb,
lib/tradier/error/configuration_error.rb,
lib/tradier/error/service_unavailable.rb,
lib/tradier/error/unprocessable_entity.rb,
lib/tradier/error/internal_server_error.rb
Overview
Custom error class for rescuing from all Tradier errors
Direct Known Subclasses
Defined Under Namespace
Classes: BadGateway, BadRequest, ClientError, ConfigurationError, DecodeError, Forbidden, GatewayTimeout, 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 = {}) ⇒ Tradier::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(exception = $!, response_headers = {}) ⇒ Tradier::Error
Initializes a new Error object
24 25 26 27 |
# File 'lib/tradier/error.rb', line 24 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/tradier/error.rb', line 4 def wrapped_exception @wrapped_exception end |
Class Method Details
.descendants ⇒ Array
15 16 17 |
# File 'lib/tradier/error.rb', line 15 def self.descendants ObjectSpace.each_object(::Class).select{|klass| klass < self} end |
.errors ⇒ Hash
7 8 9 10 11 12 |
# File 'lib/tradier/error.rb', line 7 def self.errors @errors ||= descendants.each_with_object({}) do |klass, hash| hash[klass::HTTP_STATUS_CODE] = klass if defined?(klass::HTTP_STATUS_CODE) hash.update(klass.errors) end end |
Instance Method Details
#backtrace ⇒ Object
29 30 31 |
# File 'lib/tradier/error.rb', line 29 def backtrace @wrapped_exception.respond_to?(:backtrace) ? @wrapped_exception.backtrace : super end |