lib/sword2ruby/deposit_receipt.rb in sword2ruby-1.0.0 vs lib/sword2ruby/deposit_receipt.rb in sword2ruby-1.0.1

- old
+ new

@@ -29,13 +29,24 @@ @location = response.header["location"] @status_code = response.code @status_message = response.message if response.body + #If a receipt was returned, parse it - @entry = ::Atom::Entry.parse(response.body) - @entry.http = connection - @has_entry = true + begin + #ensure that there are not parse errors. If there are, warn, rather then raise + @entry = ::Atom::Entry.parse(response.body) + @has_entry = true + @entry.http = connection + rescue Exception => message + @has_entry = false + $stderr.puts "ERROR: An error occured processing the Response XML: #{message}" + rescue StandardError => error + @has_entry = false + $stderr.puts "WARN: The deposit was successful, but there was an issue with Response XML. It could be missing. (#{error})" + end + else #if the receipt was not returned, try and retrieve it if @location @entry = ::Atom::Entry.parse(connection.get(@location).body) @has_entry = true \ No newline at end of file