Class: Mock::Twilio::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/mock/twilio/util/error_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ErrorHandler

Returns a new instance of ErrorHandler.



6
7
8
# File 'lib/mock/twilio/util/error_handler.rb', line 6

def initialize(response)
  @response = response
end

Instance Method Details

#raiseObject



10
11
12
13
14
# File 'lib/mock/twilio/util/error_handler.rb', line 10

def raise
  return @response.body if @response.headers["content-type"].include?("application/json")

  @response.reason_phrase
end