From ee2e270cd435adfc8396037659c30bf76bc483c0 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 18 Dec 2018 15:19:53 +0100 Subject: [PATCH] better error reporting on import --- app/models/doi.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/doi.rb b/app/models/doi.rb index 3fb37e792..137cb4720 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -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={}) @@ -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 @@ -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