diff --git a/app/jobs/transfer_job.rb b/app/jobs/transfer_job.rb index ee323cd45..36d3a2873 100644 --- a/app/jobs/transfer_job.rb +++ b/app/jobs/transfer_job.rb @@ -2,13 +2,15 @@ class TransferJob < ActiveJob::Base queue_as :lupo_background def perform(doi_id, options={}) + logger = Logger.new(STDOUT) doi = Doi.where(doi: doi_id).first - if doi.present? - doi.update_attributes(datacentre: options[:target_id]) - else - logger = Logger.new(STDOUT) + if doi.blank? logger.info "[Transfer] Error transferring DOI " + doi_id + ": not found" + elsif doi.update_attributes(datacentre: options[:target_id]) + logger.info "[Transfer] Successfully transferred DOI " + doi_id + else + logger.info "[Transfer] Error transferring DOI " + doi_id + ": " + errors.inspect end end end \ No newline at end of file