views:

730

answers:

4

I'm trying to get this up and running, but I see "uninitialized constant ExceptionNotifier" whenever I start my server.

http://github.com/rails/exception_notification

In my Gemfile I have

gem "exception_notification", :git => "http://github.com/rails/exception_notification.git", :branch => "master"

I've tried putting the configuration as shown in the github readme inside of config/application.rb, config/environment.rb, and config.ru. I replaced "Whatever" with my application name.

+2  A: 

It seems that Rails 3 can't use this plugin in gem form. Maybe rack apps can't be loaded from gems? I installed it as a plugin instead and changed the config syntax to:

config.middleware.use "::ExceptionNotifier"

instead of

config.middleware.use ExceptionNotifier

Darren Hinderer
Could you provide the whole config-file? I'm having the same problem...
Lichtamberg
+1  A: 

It took a bit of work but I got Exception Notifier working with Rails 3.0.0:

1- rails plugin install http://github.com/sickill/exception_notification.git

(If you don't want to use this fork, just apply his patch manually to the original rails plugin--it is only 3 lines http://bit.ly/bK2ApI ) It fixes the 'undefined method controller_name error'

2- In application.rb:

config.middleware.use "::ExceptionNotifier" , :email_prefix => "[Whatever] ",
                           :sender_address => %{"notifier" <[email protected]>},
                           :exception_recipients => %w{[email protected]} 

3- Apply Lawrence Pit's patch http://bit.ly/da80YI It fixes the 'uninitialized constant ActiveRecord::RecordNotFound' error as documented here: http://bit.ly/9RXUvK

That's it.

serpico7456
+2  A: 

Actually, now, it is much easier. In your Gemfile you need to write:

gem "exception_notification", :git => "http://github.com/rails/exception_notification.git", :require => 'exception_notifier'

And all should be fixed. The :require option is crucial (i guess because the names differ you have to specify explicitly). All other patches mentioned before have been merged i presume.

nathanvda
Did you try that? It doesnt work for me?
Lichtamberg
Yes definitely. I use the above line in my Gemfile, and in my application.rb i have the `config.middleware.use ...` and that's all i needed to do. Do you still have the uninitialized constant error?
nathanvda
The `:git` part is also crucial. The latest published gem (2.3.3.0 right now) does not work with Rails 3.
Steve Madsen
+2  A: 

Ok, its working now for me:

# Gemfile
gem "exception_notification", :git => "git://github.com/rails/exception_notification", :require => 'exception_notifier'

# application.rb, inside the config block
config.middleware.use ::ExceptionNotifier,
  :email_prefix => "ApplicationName-Errors: ",
  :sender_address => %w{[email protected]},
  :exception_recipients => %w{[email protected]}
Lichtamberg