File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,16 @@ def default_options
3131 end
3232 end
3333
34+ class MissingController
35+ def method_missing ( *args , &block )
36+ end
37+ end
38+
3439 def exception_notification ( env , exception )
3540 @env = env
3641 @exception = exception
3742 @options = ( env [ 'exception_notifier.options' ] || { } ) . reverse_merge ( self . class . default_options )
38- @controller = env [ 'action_controller.instance' ]
43+ @controller = env [ 'action_controller.instance' ] || MissingController . new
3944 @request = ActionDispatch ::Request . new ( env )
4045 @backtrace = clean_backtrace ( exception )
4146 @sections = @options [ :sections ]
@@ -47,7 +52,7 @@ def exception_notification(env, exception)
4752
4853 prefix = "#{ @options [ :email_prefix ] } #{ @controller . controller_name } ##{ @controller . action_name } "
4954 subject = "#{ prefix } (#{ @exception . class } ) #{ @exception . message . inspect } "
50-
55+
5156 mail ( :to => @options [ :exception_recipients ] , :from => @options [ :sender_address ] , :subject => subject ) do |format |
5257 format . text { render "#{ mailer_name } /exception_notification" }
5358 end
You can’t perform that action at this time.
0 commit comments