Exception: Edmunds::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Edmunds::Error
- Defined in:
- lib/edmunds/error.rb
Constant Summary collapse
- BadRequest =
Class.new self
Class.new self
- Forbidden =
Class.new self
- NotFound =
Class.new self
- InternalServerError =
Class.new self
- BadGateway =
Class.new self
Class.new self
- GatewayTimeout =
Class.new self
- Unknown =
Class.new self
- ERRORS =
{ 400 => Edmunds::Error::BadRequest, 401 => Edmunds::Error::Unauthorized, 403 => Edmunds::Error::Forbidden, 404 => Edmunds::Error::NotFound, 500 => Edmunds::Error::InternalServerError, 502 => Edmunds::Error::BadGateway, 503 => Edmunds::Error::ServiceUnavailable, 504 => Edmunds::Error::GatewayTimeout }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message) ⇒ Error
Returns a new instance of Error.
36 37 38 |
# File 'lib/edmunds/error.rb', line 36 def initialize() super end |
Class Method Details
.from_response(code, body) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/edmunds/error.rb', line 26 def self.from_response(code, body) = "\nHTTP response code: #{code}. " if body['message'] << "HTTP message: #{body['message']}" else << "No message in http body.\nHTTP body: #{body}" end new end |