Skip to content

Commit

Permalink
use correct variable to raise sentry error. #221
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 13, 2019
1 parent dc0c023 commit 031285d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
3 changes: 1 addition & 2 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def index

render json: ActivitySerializer.new(@activities, options).serialized_json, status: :ok
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
# Bugsnag.notify(exception)
Raven.capture_exception(error)
Raven.capture_exception(exception)

message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason")

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/clients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def index

render json: ClientSerializer.new(@clients, options).serialized_json, status: :ok
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
# Bugsnag.notify(exception)
Raven.capture_exception(error)
Raven.capture_exception(exception)

message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason")

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/data_centers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ def index

render json: DataCenterSerializer.new(@clients, options).serialized_json, status: :ok
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
# Bugsnag.notify(exception)
Raven.capture_exception(error)
Raven.capture_exception(exception)

message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason")

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def index

render json: ProviderSerializer.new(@providers, options).serialized_json, status: :ok
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => exception
# Bugsnag.notify(exception)
Raven.capture_exception(error)
Raven.capture_exception(exception)

message = JSON.parse(exception.message[6..-1]).to_h.dig("error", "root_cause", 0, "reason")

Expand Down
5 changes: 2 additions & 3 deletions app/models/concerns/crosscitable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ 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)
Raven.capture_exception(error)

Raven.capture_exception(exception)

logger = Logger.new(STDOUT)
logger.error "Error " + exception.message + " for doi " + @doi + "."
logger.error exception
Expand Down
3 changes: 0 additions & 3 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ 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)
Raven.capture_exception(error)
doi
end
Expand Down Expand Up @@ -462,7 +461,6 @@ 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)
Raven.capture_exception(error)
else
count += 1
Expand Down Expand Up @@ -520,7 +518,6 @@ 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)
Raven.capture_exception(error)
else
count += 1
Expand Down

0 comments on commit 031285d

Please sign in to comment.