Exception: Azimuth::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Azimuth::Error
- Defined in:
- lib/azimuth/error.rb
Overview
Custom error class
Direct Known Subclasses
Class Method Summary collapse
-
.from_response(response) ⇒ Azimuth::Error
Returns the Error based on status and response message.
Class Method Details
.from_response(response) ⇒ Azimuth::Error
Returns the Error based on status and response message.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/azimuth/error.rb', line 10 def self.from_response(response) parsed_response_info = ::MultiJson.load(response[:body])['info'] status_code = parsed_response_info['statuscode'] return if status_code == 0 if = parsed_response_info['messages'] = .join(' ') end case status_code when 400 raise Azimuth::ErrorWithInput, when 403 raise Azimuth::KeyRelatedError, when 500 raise Azimuth::UnknownError, when 600...699 raise Azimuth::OtherError, end end |