# This initializer is for the Sentry exception tracking system.
#
# "Raven" is the ruby library that is the client to sentry, and it's
# config file would be "config/raven.yml". If that config doesn't exist,
# nothing happens.  If it *does*, we register a callback with Canvas::Errors
# so that every time an exception is reported, we can fire off a sentry
# call to track it and aggregate it for us.
settings = ConfigFile.load("raven")

if settings.present?
  require "raven/base"
  Raven.configure do |config|
    config.silence_ready = true
    config.dsn = settings[:dsn]
    config.tags = settings.fetch(:tags, {}).merge('canvas_revision' => Canvas.revision)
    config.sanitize_fields += Rails.application.config.filter_parameters.map(&:to_s)
    config.sanitize_credit_cards = false
  end

  Rails.configuration.to_prepare do
    Canvas::Errors.register!(:sentry_notification) do |exception, data|
      setting = Setting.get("sentry_error_logging_enabled", 'true')
      SentryProxy.capture(exception, data) if setting == 'true'
    end
  end

end

# This initializer is for the Sentry exception tracking system.
#
# "Raven" is the ruby library that is the client to sentry, and it's
# config file would be "config/raven.yml". If that config doesn't exist,
# nothing happens.  If it *does*, we register a callback with Canvas::Errors
# so that every time an exception is reported, we can fire off a sentry
# call to track it and aggregate it for us.
settings = ConfigFile.load("raven")

if settings.present?
  require "raven/base"
  Raven.configure do |config|
    config.silence_ready = true
    config.dsn = settings[:dsn]
    config.tags = settings.fetch(:tags, {}).merge('canvas_revision' => Canvas.revision)
    config.sanitize_fields += Rails.application.config.filter_parameters.map(&:to_s)
    config.sanitize_credit_cards = false
    config.excluded_exceptions += %w{AuthenticationMethods::AccessTokenError}
  end

  Rails.configuration.to_prepare do
    Canvas::Errors.register!(:sentry_notification) do |exception, data|
      setting = Setting.get("sentry_error_logging_enabled", 'true')
      SentryProxy.capture(exception, data) if setting == 'true'
    end
  end

end

Stop shipping AuthenticationMethods::AccessTokenError to Sentry
Stop shipping AuthenticationMethods::AccessTokenError to Sentry

Change-Id: I4737b512fcbd8239f508fcc01f52728a0e91bfff
Reviewed-on: https://gerrit.instructure.com/62543
Reviewed-by: Brian Palmer <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@instructure.com>
Product-Review: Tyler Pickett <3f20fcf21b1970c94966160adcf831eedd808a06@instructure.com>
QA-Review: Tyler Pickett <3f20fcf21b1970c94966160adcf831eedd808a06@instructure.com>
Tested-by: Jenkins
