From f968fb96d945c8b68916b082f699bea892bf520d Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Fri, 1 Mar 2019 13:13:42 -0600 Subject: [PATCH] Remove airbrake --- Gemfile | 3 - Gemfile.lock | 4 - config/initializers/airbrake.rb | 87 --------------------- config/initializers/error_handler.rb | 2 - lib/error_handler/error_handler_airbrake.rb | 8 -- lib/error_handler/error_handler_null.rb | 6 -- lib/insert/insert_card.rb | 2 - lib/insert/insert_charge.rb | 5 -- lib/job_types/email_job.rb | 1 - 9 files changed, 118 deletions(-) delete mode 100644 config/initializers/airbrake.rb delete mode 100644 config/initializers/error_handler.rb delete mode 100644 lib/error_handler/error_handler_airbrake.rb delete mode 100644 lib/error_handler/error_handler_null.rb diff --git a/Gemfile b/Gemfile index 045cb6cf..abe7d29a 100755 --- a/Gemfile +++ b/Gemfile @@ -76,9 +76,6 @@ gem 'httparty' gem 'devise' gem 'devise-async' -# https://github.com/airbrake/airbrake -gem 'airbrake', '~> 6.2.1' - # http://www.rubygeocoder.com/ gem 'geocoder' # for adding latitude and longitude to location-based tables diff --git a/Gemfile.lock b/Gemfile.lock index 8c991acd..3f262e34 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,9 +70,6 @@ GEM i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) addressable (2.3.8) - airbrake (6.2.1) - airbrake-ruby (~> 2.3, >= 2.3.1) - airbrake-ruby (2.3.2) amq-protocol (2.2.0) andand (1.3.3) arel (3.0.3) @@ -427,7 +424,6 @@ PLATFORMS DEPENDENCIES action_mailer_matchers - airbrake (~> 6.2.1) aws-sdk aws-ses binding_of_caller diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb deleted file mode 100644 index f75a73c5..00000000 --- a/config/initializers/airbrake.rb +++ /dev/null @@ -1,87 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -require 'airbrake/delayed_job' - -# Airbrake is an online tool that provides robust exception tracking in your Rails -# applications. In doing so, it allows you to easily review errors, tie an error -# to an individual piece of code, and trace the cause back to recent -# changes. Airbrake enables for easy categorization, searching, and prioritization -# of exceptions so that when errors occur, your team can quickly determine the -# root cause. -# -# Configuration details: -# https://github.com/airbrake/airbrake-ruby#configuration -if ENV['AIRBRAKE_PROJECT_ID'] && ENV['AIRBRAKE_API_KEY'] - Airbrake.configure do |c| - # You must set both project_id & project_key. To find your project_id and - # project_key navigate to your project's General Settings and copy the values - # from the right sidebar. - # https://github.com/airbrake/airbrake-ruby#project_id--project_key - c.project_id = ENV['AIRBRAKE_PROJECT_ID'] || 1 - c.project_key = ENV['AIRBRAKE_API_KEY'] || 1 - - # Configures the root directory of your project. Expects a String or a - # Pathname, which represents the path to your project. Providing this option - # helps us to filter out repetitive data from backtrace frames and link to - # GitHub files from our dashboard. - # https://github.com/airbrake/airbrake-ruby#root_directory - c.root_directory = Rails.root - - # By default, Airbrake Ruby outputs to STDOUT. In Rails apps it makes sense to - # use the Rails' logger. - # https://github.com/airbrake/airbrake-ruby#logger - c.logger = Rails.logger - - # Configures the environment the application is running in. Helps the Airbrake - # dashboard to distinguish between exceptions occurring in different - # environments. - # NOTE: This option must be set in order to make the 'ignore_environments' - # option work. - # https://github.com/airbrake/airbrake-ruby#environment - c.environment = Rails.env - - # Setting this option allows Airbrake to filter exceptions occurring in - # unwanted environments such as :test. - # NOTE: This option *does not* work if you don't set the 'environment' option. - # https://github.com/airbrake/airbrake-ruby#ignore_environments - c.ignore_environments = %w(test) - - # A list of parameters that should be filtered out of what is sent to - # Airbrake. By default, all "password" attributes will have their contents - # replaced. - # https://github.com/airbrake/airbrake-ruby#blacklist_keys - c.blacklist_keys = [/password/i, /authorization/i] - - # Alternatively, you can integrate with Rails' filter_parameters. - # Read more: https://goo.gl/gqQ1xS - # c.blacklist_keys = Rails.application.config.filter_parameters - end - - # A filter that collects request body information. Enable it if you are sure you - # don't send sensitive information to Airbrake in your body (such as passwords). - # https://github.com/airbrake/airbrake#requestbodyfilter - # Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new) - - - - - # config.ignore << "ArgumentError: invalid byte sequence in UTF-8" - # config.ignore << "SIGTERM" - # end - - ignore_exceptions = [ActionDispatch::RemoteIp::IpSpoofAttackError, Encoding::CompatibilityError, - EOFError, AWS::SES::ResponseError, [SignalException, lambda {|e| e.signo == Signal.list['TERM']}]] - Airbrake.add_filter do |notice| - ignore_exceptions.each do |type| - if type.class == Array - notice.ignore! if notice.stash[:exception].is_a?(type[0]) && type[1].call(notice.stash[:exception]) - else - notice.ignore! if notice.stash[:exception].is_a?(type) - end - end - end - -end -# If you want to convert your log messages to Airbrake errors, we offer an -# integration with the Logger class from stdlib. -# https://github.com/airbrake/airbrake#logger -# Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger) diff --git a/config/initializers/error_handler.rb b/config/initializers/error_handler.rb deleted file mode 100644 index db6b7651..00000000 --- a/config/initializers/error_handler.rb +++ /dev/null @@ -1,2 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -#ERROR_HANDLER = ENV['ERROR_HANDLER_CLASS'] ? ENV['ERROR_HANDLER_CLASS'].constantize : ErrorHandler::NullErrorHandler \ No newline at end of file diff --git a/lib/error_handler/error_handler_airbrake.rb b/lib/error_handler/error_handler_airbrake.rb deleted file mode 100644 index d4d23b44..00000000 --- a/lib/error_handler/error_handler_airbrake.rb +++ /dev/null @@ -1,8 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module ErrorHandler - class AirbrakeErrorHandler - def notify(*params) - Airbrake.notify(*params) - end - end -end \ No newline at end of file diff --git a/lib/error_handler/error_handler_null.rb b/lib/error_handler/error_handler_null.rb deleted file mode 100644 index e13d7403..00000000 --- a/lib/error_handler/error_handler_null.rb +++ /dev/null @@ -1,6 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module ErrorHandler - class NullErrorHandler - def notify; end - end -end \ No newline at end of file diff --git a/lib/insert/insert_card.rb b/lib/insert/insert_card.rb index 78d472d1..dfb7709e 100644 --- a/lib/insert/insert_card.rb +++ b/lib/insert/insert_card.rb @@ -111,10 +111,8 @@ module InsertCard rescue ActiveRecord::ActiveRecordError => e return {json: {error: "Oops! There was an error saving your card, and it did not complete. Please try again in a moment. Error: #{e}"}, status: :unprocessable_entity} rescue e - Airbrake.notify(e) return {json: {error: "Oops! There was an error saving your card, and it did not complete. Please try again in a moment. Error: #{e}"}, status: :unprocessable_entity} rescue e - Airbrake.notify(e) return {json: {error: "Oops! There was an error saving your card, and it did not complete. Please try again in a moment. Error: #{e}"}, status: :unprocessable_entity} end diff --git a/lib/insert/insert_charge.rb b/lib/insert/insert_charge.rb index 6286fa8f..15433c83 100644 --- a/lib/insert/insert_charge.rb +++ b/lib/insert/insert_charge.rb @@ -65,7 +65,6 @@ module InsertCharge unless card.holder == supporter if (data[:old_donation]) #these are not new donations so we let them fly (for now) - Airbrake.notify(ParamValidation::ValidationError.new("#{data[:card_id]} does not belong to this supporter #{supporter.id} as warning", {:key => :card_id})) else raise ParamValidation::ValidationError.new("#{data[:card_id]} does not belong to this supporter #{supporter.id}", {:key => :card_id}) end @@ -77,7 +76,6 @@ module InsertCharge stripe_customer_id = card.stripe_customer_id stripe_account_id = StripeAccount.find_or_create(data[:nonprofit_id]) rescue => e - Airbrake.notify(e, other_data: data) raise e end nonprofit_currency = Qx.select(:currency).from(:nonprofits).where("id=$id", id: data[:nonprofit_id]).execute.first['currency'] @@ -117,10 +115,8 @@ module InsertCharge stripe_charge = Stripe::Charge.create(*params) rescue Stripe::CardError => e failure_message = "There was an error with your card: #{e.json_body[:error][:message]}" - Airbrake.notify(e) rescue Stripe::StripeError => e failure_message = "We're sorry, but something went wrong. We've been notified about this issue." - Airbrake.notify(e) end @@ -163,7 +159,6 @@ module InsertCharge return result rescue => e - Airbrake.notify(e) raise e end end diff --git a/lib/job_types/email_job.rb b/lib/job_types/email_job.rb index 214f5da3..e5811637 100644 --- a/lib/job_types/email_job.rb +++ b/lib/job_types/email_job.rb @@ -14,7 +14,6 @@ module JobTypes end def error(job, exception) - Airbrake.notify(exception) end def reschedule_at(current_time, attempts)