lib/soaspec/exchange_handlers/soap_handler.rb in soaspec-0.0.36 vs lib/soaspec/exchange_handlers/soap_handler.rb in soaspec-0.0.37

- old
+ new

@@ -82,15 +82,19 @@ # Used in together with Exchange request that passes such override parameters def make_request(override_parameters) test_values = override_parameters # Used in Erb # Erb parses template file, executing Ruby code in `<% %>` blocks to work out final request test_values = test_values.transform_keys_to_symbols if Soaspec::Environment.always_use_keys? - if @request_option == :template - request_body = File.read('template/' + template_name + '.xml') - render_body = ERB.new(request_body).result(binding) - @client.call(operation, xml: render_body) # Call the SOAP operation with the request XML provided - elsif @request_option == :hash - @client.call(operation, message: @default_hash.merge(test_values), attributes: request_root_attributes) + begin + if @request_option == :template + request_body = File.read('template/' + template_name + '.xml') + render_body = ERB.new(request_body).result(binding) + @client.call(operation, xml: render_body) # Call the SOAP operation with the request XML provided + elsif @request_option == :hash + @client.call(operation, message: @default_hash.merge(test_values), attributes: request_root_attributes) + end + rescue Savon::HTTPError => e + e end end # Set the default hash representing data to be used in making a request # This will set the @request_option instance variable too \ No newline at end of file