lib/intercom/request.rb in intercom-2.1.2 vs lib/intercom/request.rb in intercom-2.1.3
- old
+ new
@@ -66,28 +66,28 @@
end
raise_errors_on_failure(response)
parsed_body
end
rescue Timeout::Error
- raise Intercom::ServiceUnavailableError
+ raise Intercom::ServiceUnavailableError.new('Service Unavailable')
end
def decode(content_encoding, body)
return body if (!body) || body.empty? || content_encoding != 'gzip'
Zlib::GzipReader.new(StringIO.new(body)).read
end
def raise_errors_on_failure(res)
if res.code.to_i.eql?(404)
- raise Intercom::ResourceNotFound
+ raise Intercom::ResourceNotFound.new('Resource Not Found')
elsif res.code.to_i.eql?(401)
- raise Intercom::AuthenticationError
+ raise Intercom::AuthenticationError.new('Unauthorized')
elsif res.code.to_i.eql?(500)
- raise Intercom::ServerError
+ raise Intercom::ServerError.new('Server Error')
elsif res.code.to_i.eql?(502)
- raise Intercom::BadGatewayError
+ raise Intercom::BadGatewayError.new('Bad Gateway Error')
elsif res.code.to_i.eql?(503)
- raise Intercom::ServiceUnavailableError
+ raise Intercom::ServiceUnavailableError.new('Service Unavailable')
end
end
def raise_application_errors_on_failure(error_list_details, http_code)
# Currently, we don't support multiple errors