bsc-networks / workshift-website

A new workshift website, created by students of CS169
MIT License
3 stars 0 forks source link

How to get an e-mail to an admin on "We're sorry, but something went wrong." #51

Closed mitar closed 9 years ago

mitar commented 9 years ago

So when something does not work, user gets "We're sorry, but something went wrong." page. Is there a way to also send an e-mail to a site admin when that happens? With debugging info? At least I am used to that in Django. Or is there some other way in Ruby to access all such incidents?

mlequeux commented 9 years ago

I'd go with http://smartinez87.github.io/exception_notification/, but since production.rb is mounted from the container, you'll need to put this in production.rb, :

Rails.application.config.middleware.use ExceptionNotification::Rack,
  :email => {
    :email_prefix         => "[PREFIX] ",
    :sender_address       => %{"notifier" <notifier@example.com>},
    :exception_recipients => %w{exceptions@example.com},
    :delivery_method => :smtp,
    :smtp_settings => {
      :user_name => "bob",
      :password => "password",
    }
  }

I'll take care of the rest when this is done and close the issue

PS : You can also revert production.rb to not display any debug.

mitar commented 9 years ago

Do I have to install anything?

Are SMTP settings necessary, they cannot be reused from the other section? So I have to supply them again?

What is w in %w? Why sender_address does not have one?

mitar commented 9 years ago

I configured the file, you should be getting e-mails as well. Do we have to wait for Docker image update? Can you test it if it works?

mitar commented 9 years ago

It seems it works.