File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,19 @@ def self.default_ignore_exceptions
1212
1313 def initialize ( app , options = { } )
1414 @app , @options = app , options
15+
16+ Notifier . default_sender_address = @options [ :sender_address ]
17+ Notifier . default_exception_recipients = @options [ :exception_recipients ]
18+ Notifier . default_email_prefix = @options [ :email_prefix ]
19+ Notifier . default_sections = @options [ :sections ]
20+
1521 @options [ :ignore_exceptions ] ||= self . class . default_ignore_exceptions
1622 end
1723
1824 def call ( env )
1925 @app . call ( env )
2026 rescue Exception => exception
21- options = ( env [ 'exception_notifier.options' ] ||= { } )
27+ options = ( env [ 'exception_notifier.options' ] ||= Notifier . default_options )
2228 options . reverse_merge! ( @options )
2329
2430 unless Array . wrap ( options [ :ignore_exceptions ] ) . include? ( exception . class )
Original file line number Diff line number Diff line change @@ -7,20 +7,25 @@ class Notifier < ActionMailer::Base
77 self . append_view_path "#{ File . dirname ( __FILE__ ) } /views"
88
99 class << self
10+ attr_writer :default_sender_address
11+ attr_writer :default_exception_recipients
12+ attr_writer :default_email_prefix
13+ attr_writer :default_sections
14+
1015 def default_sender_address
11- %("Exception Notifier" <[email protected] >) 16+ @default_sender_address || %("Exception Notifier" <[email protected] >) 1217 end
1318
1419 def default_exception_recipients
15- [ ]
20+ @default_exception_recipients || [ ]
1621 end
1722
1823 def default_email_prefix
19- "[ERROR] "
24+ @default_email_prefix || "[ERROR] "
2025 end
2126
2227 def default_sections
23- %w( request session environment backtrace )
28+ @default_sections || %w( request session environment backtrace )
2429 end
2530
2631 def default_options
You can’t perform that action at this time.
0 commit comments