Module: Notificate::Rails::Controller

Included in:
Notificate::Rails
Defined in:
lib/notificate-rails/controller.rb

Defined Under Namespace

Modules: ControllerMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



2
3
4
# File 'lib/notificate-rails/controller.rb', line 2

def self.included(klass)
  klass.extend ControllerMethods
end

Instance Method Details

#_notificate_around_filterObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/notificate-rails/controller.rb', line 17

def _notificate_around_filter
  begin
    yield
  rescue Object => error
    handler = error.respond_to?(:original_exception) ? error.original_exception : error

    notify_notificate(error) unless handler_for_rescue(handler)

    raise
  end
end

#notify_notificate(exception) ⇒ Object



13
14
15
# File 'lib/notificate-rails/controller.rb', line 13

def notify_notificate(exception)
  ::Notificate::ExceptionCatcher.notify(exception, rails_data)
end

#rails_dataObject



6
7
8
9
10
11
# File 'lib/notificate-rails/controller.rb', line 6

def rails_data
  {
    environment: ::Notificate::Rails.options.environment,
    root:        ::Notificate::Rails.options.project_root
  }
end