Exception: Camp3::Error::ResponseError

Inherits:
Error
  • Object
show all
Defined in:
lib/camp3/error.rb

Overview

Custom error class for rescuing from HTTP response errors.

Constant Summary collapse

POSSIBLE_MESSAGE_KEYS =
%i[message error_description error].freeze

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ResponseError

Returns a new instance of ResponseError.



21
22
23
24
# File 'lib/camp3/error.rb', line 21

def initialize(response)
  @response = response
  super(build_error_message)
end

Instance Method Details

#response_messageString

Body content returned in the HTTP response

Returns:

  • (String)


36
37
38
# File 'lib/camp3/error.rb', line 36

def response_message
  @response.parsed_response.message
end

#response_statusInteger

Status code returned in the HTTP response.

Returns:

  • (Integer)


29
30
31
# File 'lib/camp3/error.rb', line 29

def response_status
  @response.code
end