Skip to content

Commit

Permalink
better error reporting on import
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Dec 18, 2018
1 parent e7d8965 commit ee2e270
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ def self.import_one(doi: nil)
# update_attributes will trigger validations and Elasticsearch indexing
doi.update_attributes(attrs)
logger.info "[MySQL] Imported metadata for DOI " + doi.doi + "."
rescue TypeError, NoMethodError, ActiveRecord::LockWaitTimeout => error
rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error
logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message
Bugsnag.notify(error)
end

def self.import_all(options={})
Expand Down Expand Up @@ -398,6 +399,7 @@ def self.import_by_day(options={})
doi.update_columns(attrs)
rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error
logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message
Bugsnag.notify(error)
else
count += 1
end
Expand Down Expand Up @@ -428,6 +430,7 @@ def self.import_by_day_missing(options={})
doi.update_columns(attrs)
rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error
logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message
Bugsnag.notify(error)
else
count += 1
end
Expand Down

0 comments on commit ee2e270

Please sign in to comment.