We use exception_notification gem in our project and we're seeing missing template errors now. Here's 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 the exception occurs, we do indeed receive the email, but the rendered error page is an unstyled mix of raw ERB and text, not pretty at all <screenshot> and the error message in our log is:
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 app/views
folder, but in the gems folder I do 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
Looks like Rails is looking for the view /exception_notification.text.erb in exception_notification-3.0.1/lib/exception_notifier/views
and not in the exception_notifier
subdirectory there. At this point, I'm not sure if this is a problem with Rails or the exception_notification gem, but given that the emails are sent, I'm not sure why there's an error message at all.
Thanks for taking a look and for any guidance.