From 81e719d10624e9bc84ba9d615b208e6a04754ed5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 12 Mar 2019 18:36:02 +0100 Subject: [PATCH] remove custom bugsnag calls. #214 --- app/controllers/activities_controller.rb | 3 ++- app/controllers/application_controller.rb | 1 + app/controllers/clients_controller.rb | 3 ++- app/controllers/data_centers_controller.rb | 3 ++- app/controllers/members_controller.rb | 2 +- app/controllers/providers_controller.rb | 3 ++- app/models/concerns/crosscitable.rb | 4 +++- app/models/doi.rb | 9 ++++++--- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index fe676f0f7..134174898 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -50,7 +50,8 @@ def index render json: ActivitySerializer.new(@activities, options).serialized_json, status: :ok rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) + Raven.capture_exception(error) message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason") diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8671792d4..68f669a7b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -103,6 +103,7 @@ def authenticated_user message = exception.message else # Bugsnag.notify(exception) + Raven.capture_exception(error) message = exception.message end diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 91d4a96c7..40f7733ac 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -62,7 +62,8 @@ def index render json: ClientSerializer.new(@clients, options).serialized_json, status: :ok rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) + Raven.capture_exception(error) message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason") diff --git a/app/controllers/data_centers_controller.rb b/app/controllers/data_centers_controller.rb index 6cb147511..4ee2a4d05 100644 --- a/app/controllers/data_centers_controller.rb +++ b/app/controllers/data_centers_controller.rb @@ -56,7 +56,8 @@ def index render json: DataCenterSerializer.new(@clients, options).serialized_json, status: :ok rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) + Raven.capture_exception(error) message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason") diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index f8fd1ffd6..59c756aec 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -61,7 +61,7 @@ def index render json: MemberSerializer.new(@members, options).serialized_json, status: :ok rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason") diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index d61a7f466..d5c7002db 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -64,7 +64,8 @@ def index render json: ProviderSerializer.new(@providers, options).serialized_json, status: :ok rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) + Raven.capture_exception(error) message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason") diff --git a/app/models/concerns/crosscitable.rb b/app/models/concerns/crosscitable.rb index 01b6682ad..7f8313ad5 100644 --- a/app/models/concerns/crosscitable.rb +++ b/app/models/concerns/crosscitable.rb @@ -40,7 +40,9 @@ def parse_xml(input, options={}) meta = from.present? ? send("read_" + from, { string: input, doi: options[:doi], sandbox: sandbox }).compact : {} meta.merge("string" => input, "from" => from) rescue NoMethodError, ArgumentError => exception - Bugsnag.notify(exception) + # Bugsnag.notify(exception) + Raven.capture_exception(error) + logger = Logger.new(STDOUT) logger.error "Error " + exception.message + " for doi " + @doi + "." logger.error exception diff --git a/app/models/doi.rb b/app/models/doi.rb index 5ec45e5b4..17bd0489d 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -386,7 +386,8 @@ def self.import_one(doi_id: nil) doi rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message - Bugsnag.notify(error) + # Bugsnag.notify(error) + Raven.capture_exception(error) doi end @@ -458,7 +459,8 @@ def self.import_by_day(options={}) doi.__elasticsearch__.index_document rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message - Bugsnag.notify(error) + # Bugsnag.notify(error) + Raven.capture_exception(error) else count += 1 end @@ -515,7 +517,8 @@ def self.import_by_day_missing(options={}) doi.__elasticsearch__.index_document rescue TypeError, NoMethodError, RuntimeError, ActiveRecord::StatementInvalid, ActiveRecord::LockWaitTimeout => error logger.error "[MySQL] Error importing metadata for " + doi.doi + ": " + error.message - Bugsnag.notify(error) + # Bugsnag.notify(error) + Raven.capture_exception(error) else count += 1 end