Exception: Camper::Error::ResponseError
- Defined in:
- lib/camper/error.rb
Overview
Custom error class for rescuing from HTTP response errors.
Direct Known Subclasses
BadGateway, BadRequest, Conflict, Forbidden, GatewayTimeout, InternalServerError, MethodNotAllowed, NotAcceptable, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, Unprocessable
Constant Summary collapse
- POSSIBLE_MESSAGE_KEYS =
%i[message error_description error].freeze
Instance Method Summary collapse
-
#initialize(response) ⇒ ResponseError
constructor
A new instance of ResponseError.
-
#response_message ⇒ String
Body content returned in the HTTP response.
-
#response_status ⇒ Integer
Status code returned in the HTTP response.
Constructor Details
#initialize(response) ⇒ ResponseError
Returns a new instance of ResponseError.
34 35 36 37 |
# File 'lib/camper/error.rb', line 34 def initialize(response) @response = response super() end |
Instance Method Details
#response_message ⇒ String
Body content returned in the HTTP response
49 50 51 |
# File 'lib/camper/error.rb', line 49 def @response.parsed_response. end |
#response_status ⇒ Integer
Status code returned in the HTTP response.
42 43 44 |
# File 'lib/camper/error.rb', line 42 def response_status @response.code end |