Module: ExceptionHunter

Extended by:
Tracking
Defined in:
lib/exception_hunter.rb,
lib/exception_hunter/config.rb,
lib/exception_hunter/devise.rb,
lib/exception_hunter/engine.rb,
lib/exception_hunter/version.rb,
lib/exception_hunter/tracking.rb,
app/models/exception_hunter/error.rb,
lib/exception_hunter/error_reaper.rb,
lib/exception_hunter/data_redacter.rb,
lib/exception_hunter/error_creator.rb,
app/models/exception_hunter/error_group.rb,
app/jobs/exception_hunter/application_job.rb,
app/helpers/exception_hunter/errors_helper.rb,
app/jobs/exception_hunter/async_logging_job.rb,
app/helpers/exception_hunter/sessions_helper.rb,
lib/exception_hunter/notifiers/slack_notifier.rb,
app/models/exception_hunter/application_record.rb,
lib/exception_hunter/middleware/request_hunter.rb,
lib/exception_hunter/middleware/request_hunter.rb,
lib/exception_hunter/middleware/sidekiq_hunter.rb,
lib/exception_hunter/user_attributes_collector.rb,
app/helpers/exception_hunter/application_helper.rb,
app/jobs/exception_hunter/send_notification_job.rb,
app/mailers/exception_hunter/application_mailer.rb,
app/presenters/exception_hunter/error_presenter.rb,
app/controllers/exception_hunter/errors_controller.rb,
lib/exception_hunter/middleware/delayed_job_hunter.rb,
app/presenters/exception_hunter/dashboard_presenter.rb,
app/presenters/exception_hunter/error_group_presenter.rb,
lib/exception_hunter/notifiers/misconfigured_notifiers.rb,
app/controllers/concerns/exception_hunter/authorization.rb,
app/controllers/exception_hunter/application_controller.rb,
lib/exception_hunter/notifiers/slack_notifier_serializer.rb,
lib/generators/exception_hunter/install/install_generator.rb,
app/controllers/exception_hunter/ignored_errors_controller.rb,
app/controllers/exception_hunter/resolved_errors_controller.rb,
lib/generators/exception_hunter/create_users/create_users_generator.rb

Defined Under Namespace

Modules: ApplicationHelper, Authorization, Devise, ErrorsHelper, Middleware, Notifiers, SessionsHelper, Tracking, UserAttributesCollector Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, AsyncLoggingJob, Config, CreateUsersGenerator, DashboardPresenter, DataRedacter, Engine, Error, ErrorCreator, ErrorGroup, ErrorGroupPresenter, ErrorPresenter, ErrorReaper, ErrorsController, IgnoredErrorsController, InstallGenerator, Railtie, ResolvedErrorsController, SendNotificationJob

Constant Summary collapse

VERSION =
'1.1.0'.freeze

Class Method Summary collapse

Methods included from Tracking

track

Class Method Details

.routes(router) ⇒ void

This method returns an undefined value.

Mounts the ExceptionHunter dashboard at /exception_hunter if it’s enabled on the current environment.

Examples:

Rails.application.routes.draw do
  ExceptionHunter.routes(self)
end

Parameters:

  • router (ActionDispatch::Routing::Mapper)

    to mount to



41
42
43
44
45
# File 'lib/exception_hunter.rb', line 41

def self.routes(router)
  return unless Config.enabled

  router.mount(ExceptionHunter::Engine, at: 'exception_hunter')
end

.setup(&block) ⇒ void

This method returns an undefined value.

Used to setup ExceptionHunter’s configuration it receives a block with the Config singleton class.



26
27
28
29
# File 'lib/exception_hunter.rb', line 26

def self.setup(&block)
  block.call(Config)
  validate_config!
end

.validate_config!Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/exception_hunter.rb', line 48

def self.validate_config!
  notifiers = Config.notifiers
  return if notifiers.blank?

  notifiers.each do |notifier|
    next if notifier[:name] == :slack && notifier.dig(:options, :webhook).present?

    raise ExceptionHunter::Notifiers::MisconfiguredNotifiers, notifier
  end
end