diff --git a/Gemfile b/Gemfile index 2ed826e8..1e823e6d 100644 --- a/Gemfile +++ b/Gemfile @@ -184,7 +184,7 @@ group :test do gem 'stripe-ruby-mock', git: 'https://github.com/rebelidealist/stripe-ruby-mock', branch: 'live-tests' end -gem 'airbrake' +gem 'bugsnag' group :production do gem 'newrelic_rpm' gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index 5108c75b..03c64448 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,9 +86,6 @@ GEM acts_as_commentable (2.0.1) acts_as_follower (0.1.1) addressable (2.3.6) - airbrake (4.1.0) - builder - multi_json annotate (2.6.5) activerecord (>= 2.3.0) rake (>= 0.8.7) @@ -120,6 +117,8 @@ GEM debug_inspector (>= 0.0.1) blankslate (3.1.3) buftok (0.2.0) + bugsnag (2.7.1) + multi_json (~> 1.0) builder (3.0.4) byebug (2.7.0) columnize (~> 0.3) @@ -737,13 +736,13 @@ DEPENDENCIES acts-as-taggable-on (~> 3.4) acts_as_commentable (= 2.0.1) acts_as_follower (= 0.1.1) - airbrake annotate autoprefixer-rails awesome_print backbone-on-rails better_errors binding_of_caller + bugsnag capybara capybara-screenshot carrierwave diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 5486a7e1..ecefb808 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -5,7 +5,6 @@ class AccountsController < ApplicationController before_action :ensure_account_admin, except: [:create] before_action :determine_plan, only: [:create, :update] before_action :ensure_eligibility, only: [:new] - before_action :paying_user_context, if: ->() { Rails.env.production? } def new @account ||= current_user.team.build_account @@ -31,7 +30,6 @@ def create redirect_to new_team_opportunity_path(@team), notice: "You are subscribed to #{@plan.name}." + plan_capability(@plan, @team) else Rails.logger.error "Error creating account #{@account.errors.inspect}" - # Honeybadger.notify(error_class: 'Payments', error_message: @account.errors.full_messages.join("\n"), parameters: params) if Rails.env.production? flash[:error] = @account.errors.full_messages.join("\n") redirect_to employers_path end @@ -103,10 +101,6 @@ def plan_capability(plan, team) message end - def paying_user_context - # Honeybadger.context(user_email: current_user.try(:email)) if current_user - end - def account_params params.require(:teams_account).permit(:stripe_card_token) end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 20ad89d7..40d830ed 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -42,18 +42,15 @@ def create end rescue Faraday::Error::ConnectionFailed => ex Rails.logger.error("Faraday::Error::ConnectionFailed => #{ex.message}, #{ex.inspect}") - # notify_honeybadger(ex) if Rails.env.production? record_event("error", message: "attempt to reuse a linked account") flash[:error] = "Error linking #{oauth[:info][:nickname]} because it is already associated with a different member." redirect_to(root_url) rescue ActiveRecord::RecordNotUnique => ex - # notify_honeybadger(ex) if Rails.env.production? record_event("error", message: "attempt to reuse a linked account") flash[:error] = "Error linking #{oauth[:info] && oauth[:info][:nickname]} because it is already associated with a different member." redirect_to(root_url) rescue Exception => ex Rails.logger.error("Failed to link account because #{ex.message} => '#{oauth}'") - # notify_honeybadger(ex) if Rails.env.production? record_event("error", message: "signup failure") flash[:notice] = "Looks like something went wrong. Please try again." redirect_to(root_url) diff --git a/app/models/teams/account.rb b/app/models/teams/account.rb index 265c750e..c787eddb 100644 --- a/app/models/teams/account.rb +++ b/app/models/teams/account.rb @@ -45,12 +45,10 @@ def save_with_payment(plan=nil) return false end rescue Stripe::CardError => e - # Honeybadger.notify(e) if Rails.env.production? Rails.logger.error "Stripe error while creating customer: #{e.message}" if ENV['DEBUG'] errors.add :base, e.message return false rescue Stripe::InvalidRequestError => e - # Honeybadger.notify(e) if Rails.env.production? Rails.logger.error "Stripe error while creating customer: #{e.message}" if ENV['DEBUG'] errors.add :base, "There was a problem with your credit card." # throw e if Rails.env.development? diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb deleted file mode 100644 index 69edf7d4..00000000 --- a/config/initializers/airbrake.rb +++ /dev/null @@ -1,9 +0,0 @@ -if defined?(Airbrake) - Airbrake.configure do |config| - config.api_key = ENV['AIRBRAKE_API_KEY'] - end -else - unless Rails.env.test? || Rails.env.development? - Rails.logger.warn '[WTF WARNING] Someone deleted airbrake and forgot the initializer' - end -end diff --git a/config/initializers/bugsnag.rb b/config/initializers/bugsnag.rb new file mode 100644 index 00000000..5d3ef962 --- /dev/null +++ b/config/initializers/bugsnag.rb @@ -0,0 +1,9 @@ +if defined?(Bugsnag) + Bugsnag.configure do |config| + config.api_key = ENV['BUGSNAG_API_KEY'] + end +else + unless Rails.env.test? || Rails.env.development? + Rails.logger.warn '[WTF WARNING] Someone deleted bugsnag and forgot the initializer' + end +end diff --git a/spec/lib/omniauth_spec.rb b/spec/lib/omniauth_spec.rb deleted file mode 100644 index 0b3fa29e..00000000 --- a/spec/lib/omniauth_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' - -RSpec.describe 'omniauth configuration' do - let(:app) { lambda { |_env| [404, {}, ['Awesome']] } } - let(:strategy) { ExampleStrategy.new(app, @options || {}) } - - it 'should log exception to honeybadger API when auth fails', :skip do - # expect(Honeybadger).to receive(:notify_or_ignore) - - @options = { failure: :forced_fail } - strategy.call(make_env('/auth/test/callback', 'rack.session' => { 'omniauth.origin' => '/awesome' })) - end -end