Method: Castle::Core::ProcessResponse.verify!

Defined in:
lib/castle/core/process_response.rb

.verify!(response) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/castle/core/process_response.rb', line 34

def verify!(response)
  return if response.code.to_i.between?(200, 299)

  raise Castle::InternalServerError if response.code.to_i.between?(500, 599)

  error = RESPONSE_ERRORS.fetch(response.code.to_i, Castle::ApiError)
  raise error, response[:message]
end