4

I am trying to test the Exception Notifier out locally (development). Here's my current setup:

development.rb

Myapp::Application.configure do
  # Set Mailer default url
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = { :host => '0.0.0.0:3000' }
  #config.action_mailer.delivery_method = :file
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
       :address              => 'smtp.gmail.com',
       :port                 => 587,
       :domain               => 'gmail.com',
       :user_name            => 'username@gmail.com',
       :password             => 'password',
       :authentication       => 'plain',
       :enable_starttls_auto => true
   }

  config.middleware.use ExceptionNotification::Rack,
    :email => {
      :email_prefix => "[Myapp Error] ",
      :sender_address => %{"notifier" <no-reply@myapp.com>},
      :exception_recipients => %w{myemail@gmail.com}
    }
end

But when I "create" an error in the application -- for example if I set up non-existing ID, like

http://localhost:3000/users/12270/edit

I see only error in the browser, but the email is not sent out (email credentials are correct).

What do I miss?

Than you

user984621
  • 46,344
  • 73
  • 224
  • 412

3 Answers3

1

To disable the error page in development mode you need to set also:

config.consider_all_requests_local = false
spickermann
  • 100,941
  • 9
  • 101
  • 131
1

ExceptionNotifier will send messages on a 500 error. However, your test "...if I request a non-existing ID..." returns a 404 not found. From the docs:

Some rack apps (Rails in particular) utilize the "X-Cascade" header to pass the request-handling responsibility to the next middleware in the stack.

Rails' routing middleware uses this strategy, rather than raising an exception, to handle routing errors (e.g. 404s); to be notified whenever a 404 occurs, set this option to "false."

Pete
  • 10,310
  • 7
  • 53
  • 59
-2

I normally use gem letter_opener for development environment.

I think Exception Notifier doesn't send emails in development environment which is understandable as you are breaking all sort of things in development and getting errors for every one would be annoying.

Abdullah Aden
  • 882
  • 9
  • 13