Exception: Tradier::Error::ClientError
- Inherits:
-
Tradier::Error
- Object
- StandardError
- Tradier::Error
- Tradier::Error::ClientError
- Defined in:
- lib/tradier/error/client_error.rb
Overview
Raised when Tradier returns a 4xx HTTP status code or there's an error in Faraday
Direct Known Subclasses
BadRequest, Forbidden, NotAcceptable, NotFound, TooManyRequests, Unauthorized, UnprocessableEntity
Constant Summary collapse
- MESSAGE =
"Client Error"
Constants inherited from Tradier::Error
Instance Attribute Summary
Attributes inherited from Tradier::Error
Class Method Summary collapse
-
.from_response(response = {}) ⇒ Tradier::Error
Create a new error from an HTTP environment.
Instance Method Summary collapse
-
#initialize(message = nil, response_headers = {}) ⇒ Tradier::Error::ServerError
constructor
Initializes a new ServerError object.
Methods inherited from Tradier::Error
#backtrace, descendants, errors
Constructor Details
#initialize(message = nil, response_headers = {}) ⇒ Tradier::Error::ServerError
Initializes a new ServerError object
22 23 24 |
# File 'lib/tradier/error/client_error.rb', line 22 def initialize(=nil, response_headers={}) super(( || self.class.const_get(:MESSAGE)), response_headers) end |
Class Method Details
.from_response(response = {}) ⇒ Tradier::Error
Create a new error from an HTTP environment
13 14 15 |
# File 'lib/tradier/error/client_error.rb', line 13 def self.from_response(response={}) new(response[:body], response[:response_headers]) end |