lib/calendlyr/resource.rb in calendlyr-0.6.0 vs lib/calendlyr/resource.rb in calendlyr-0.7.0
- old
+ new
@@ -5,11 +5,11 @@
module Calendlyr
class Resource
attr_reader :client
- ERROR_CODES = %w[400 401 403 404 409 500]
+ ERROR_CODES = %w[400 401 403 404 424 500]
def initialize(client)
@client = client
end
@@ -50,10 +50,10 @@
def handle_response(response)
return true unless response.read_body
body = JSON.parse(response.read_body)
if ERROR_CODES.include? response.code
- raise Error, "[Error #{response.code}] #{body["title"]}. #{body["message"]}"
+ raise ResponseErrorHandler.new(response.code, body).error
else
body
end
end
end