Missing template error with Notification Notification gem and Rails 3.2

Our project uses the exception_notification stone and now we see errors in the templates. This is what our setup looks like:

# Gemfile
gem 'exception_notification'

# config/initializers/exception_notifications.rb
if Rails.env.production?  
    server_hostname = `hostname`.chomp
    Rails.application.config.middleware.use ExceptionNotifier, 
    :exception_recipients => %w(webdev@domain.com),
    :sender_address =>  %("Application Error" <admin@domain.com>),
    :email_prefix => "[#{server_hostname}] "
end

      

When an exception occurs, we do get an email, but the error page displayed is an uneven mix of raw ERB and text, not quite. < screenshot > and the error message in our log:

ActionView::MissingTemplate (Missing template /exception_notification with {:locale=>[:en], :formats=>[:text], :handlers=>[:erb, :builder]}. Searched in:
    * "/Users/j/Projects/agilebits/app/views"
    * "/Users/j/Projects/agilebits/vendor/bundle/ruby/1.9.1/gems/exception_notification-3.0.1/lib/exception_notifier/views"
):

      

Of course the views are not in my folder app/views

, but in the gems folder I have:

↪ ls -R /Users/j/Projects/agilebits/vendor/bundle/ruby/1.9.1/gems/exception_notification-3.0.1/lib/exception_notifier/views
exception_notifier

/Users/j/Projects/agilebits/vendor/bundle/ruby/1.9.1/gems/exception_notification-3.0.1/lib/exception_notifier/views/exception_notifier:
_backtrace.html.erb                        _request.html.erb                          background_exception_notification.html.erb
_backtrace.text.erb                        _request.text.erb                          background_exception_notification.text.erb
_data.html.erb                             _session.html.erb                          exception_notification.html.erb
_data.text.erb                             _session.text.erb                          exception_notification.text.erb
_environment.html.erb                      _title.html.erb
_environment.text.erb                      _title.text.erb

      

It looks like Rails is looking for the view / exception _notification.text.erb in exception_notification-3.0.1/lib/exception_notifier/views

rather than a subdirectory exception_notifier

. At the moment, I'm not sure if this is a Rails issue or cleanup_exception, but given the sending of emails, I'm not sure why the error message appears there.

Thanks for looking and for any guidance.

+3


source to share


1 answer


I had the same problem and ended up seeing exception_definition and changing where it looks for patterns in notifier.rb. The fork is at https://github.com/etcetc/exception_notification



0


source







All Articles