Skip to content

Commit

Permalink
error handling for import dois by client
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Dec 26, 2018
1 parent 3ecb0e4 commit 382fbce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tasks/client.rake
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ namespace :client do
# import DOIs for client
puts "#{client.dois.length} DOIs will be imported."
client.dois.find_each do |doi|
Doi.import_one(doi: doi.doi)
puts "DOI #{doi.doi} imported."
begin
Doi.import_one(doi: doi.doi)
puts "DOI #{doi.doi} imported."
rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout, Elasticsearch::Transport::Transport::Errors::BadRequest => error
puts "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message
end
end
end

Expand Down

0 comments on commit 382fbce

Please sign in to comment.