Class: ErrorappNotifier::Notify

Inherits:
Object
  • Object
show all
Defined in:
lib/errorapp_notifier/notify.rb

Class Method Summary collapse

Class Method Details

.ignore?(exception, request) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/errorapp_notifier/notify.rb', line 21

def ignore?(exception, request)
  ignore_class?(exception) || ignore_user_agent?(request)
end

.ignore_class?(exception) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/errorapp_notifier/notify.rb', line 25

def ignore_class?(exception)
  config.ignore_exceptions.flatten.any? do |exception_class|
    exception_class === exception.class.to_s
  end
end

.ignore_user_agent?(request) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
# File 'lib/errorapp_notifier/notify.rb', line 31

def ignore_user_agent?(request)
  config.ignore_user_agents.flatten.any? do |user_agent|
    user_agent === request.user_agent.to_s
  end
end

.notify(exception, name = nil) ⇒ Object



16
17
18
19
# File 'lib/errorapp_notifier/notify.rb', line 16

def notify(exception, name = nil)
  data = FailureData.new(exception, name)
  notify_exception(exception, data)
end

.notify_with_controller(exception, controller = nil, request = nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/errorapp_notifier/notify.rb', line 4

def notify_with_controller(exception, controller = nil, request = nil)
  data = ControllerFailureData.new(exception, controller, request)
  if data && !ignore?(exception, request)
    notify_exception(exception, data)
  end
end

.notify_with_rack(exception, environment, request) ⇒ Object



11
12
13
14
# File 'lib/errorapp_notifier/notify.rb', line 11

def notify_with_rack(exception, environment, request)
  data = RackFailureData.new(exception, environment, request)
  notify_exception(exception, data)
end