lib/exactly/client.rb in exactly-0.0.6 vs lib/exactly/client.rb in exactly-0.0.7

- old
+ new

@@ -1,14 +1,16 @@ module Exactly - class ExactlyError < StandardError + class ExactlyError < RuntimeError attr_reader :response def initialize(response) @response = response super(message) end end + class SoapFaultError < RuntimeError; end + class UpsertDataExtensionFailed < ExactlyError def message @response.to_hash[:update_response][:results][:status_message] end end @@ -56,9 +58,11 @@ soap.body = body end if response.to_hash[:create_response][:overall_status] != 'OK' raise Exactly::UpsertSubscriberFailed.new(response) end + rescue Savon::SOAP::Fault => ex + raise Exactly::SoapFaultError, "Error: Could not upsert subscriber #{customer_key}/#{email} to ExactTarget: #{ex.message}" end def upsert_data_extension(customer_key, properties) response = client.request "UpdateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do http.headers['SOAPAction'] = 'Update'