Exception: Urbanairship::Common::AirshipFailure
- Inherits:
-
StandardError
- Object
- StandardError
- Urbanairship::Common::AirshipFailure
- Includes:
- Loggable
- Defined in:
- lib/urbanairship/common.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
Raised when we get an error response from the server.
-
#error ⇒ Object
Raised when we get an error response from the server.
-
#error_code ⇒ Object
Raised when we get an error response from the server.
-
#response ⇒ Object
Raised when we get an error response from the server.
Instance Method Summary collapse
-
#from_response(response) ⇒ Object
Instantiate a ValidationFailure from a Response object.
-
#initialize ⇒ AirshipFailure
constructor
A new instance of AirshipFailure.
Methods included from Loggable
create_logger, logger, #logger
Constructor Details
#initialize ⇒ AirshipFailure
Returns a new instance of AirshipFailure.
118 119 120 121 122 123 |
# File 'lib/urbanairship/common.rb', line 118 def initialize @error = nil @error_code = nil @details = nil @response = nil end |
Instance Attribute Details
#details ⇒ Object
Raised when we get an error response from the server.
116 117 118 |
# File 'lib/urbanairship/common.rb', line 116 def details @details end |
#error ⇒ Object
Raised when we get an error response from the server.
116 117 118 |
# File 'lib/urbanairship/common.rb', line 116 def error @error end |
#error_code ⇒ Object
Raised when we get an error response from the server.
116 117 118 |
# File 'lib/urbanairship/common.rb', line 116 def error_code @error_code end |
#response ⇒ Object
Raised when we get an error response from the server.
116 117 118 |
# File 'lib/urbanairship/common.rb', line 116 def response @response end |
Instance Method Details
#from_response(response) ⇒ Object
Instantiate a ValidationFailure from a Response object
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/urbanairship/common.rb', line 126 def from_response(response) payload = response.body @error = payload['error'] @error_code = payload['error_code'] @details = payload['details'] @response = response logger.error("Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}") self end |