Module: Notifiable

Includes:
SuperExceptionNotifier::NotifiableHelper
Defined in:
lib/notifiable.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from SuperExceptionNotifier::HelpfulHashes

SuperExceptionNotifier::HelpfulHashes::HTTP_STATUS_CODES, SuperExceptionNotifier::HelpfulHashes::SILENT_EXCEPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SuperExceptionNotifier::HooksNotifier

build_web_hook_params, deliver_exception_to_web_hooks, post_hook

Methods included from SuperExceptionNotifier::GitBlame

#blame_output, #exception_in_project?, #lay_blame

Methods included from SuperExceptionNotifier::HelpfulHashes

#codes_for_error_classes

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/notifiable.rb', line 4

def self.included(base)
  base.extend ClassMethods

  # Verbosity of the gem
  base.cattr_accessor :notifiable_verbose
  base.notifiable_verbose = false
  # Do Not Ever send error notification emails for these Error Classes
  base.cattr_accessor :notifiable_silent_exceptions
  base.notifiable_silent_exceptions = SILENT_EXCEPTIONS
  # Notification Level
  base.cattr_accessor :notifiable_notification_level
  base.notifiable_notification_level = [:email, :web_hooks]

  # Since there is no concept of locality from a request here allow user to explicitly define which env's are noisy (send notifications)
  base.cattr_accessor :notifiable_noisy_environments
  base.notifiable_noisy_environments = [:production]
end

Instance Method Details

#be_silent_for_exception?(exception) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/notifiable.rb', line 48

def be_silent_for_exception?(exception)
  self.class.be_silent_for_exception?(exception)
end

#notifiable(&block) ⇒ Object

Usage:

notifiable { Klass.some_method }

This will rescue any errors that occur within Klass.some_method



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

def notifiable(&block)
  yield
rescue => exception
  rescue_with_hooks(exception)
  raise
end