Notifications for exceptions

I’d like to add error notifications to an app I’m building. For example, you get an email when an exception occurs.

This must be a common problem, so I’m curious how others do it.

The options I can think of are

  • Create your own solution
    • E.g. Explicitly handle exceptions and notification sending through an ErrorMailer and other mediums like SMS, IRC, HipChat, etc.
  • Use Raygun
  • Use exception_notification gem
  • Something else…?

How do you solve this problem in your own apps?

I’ve been using this gem for years:

gem 'exception_notification'

It’s super easy to setup. I’ve got something like this in each of my env.rb files:

  config.middleware.use ExceptionNotification::Rack,
                        email: {
                            email_prefix: "[MY_APP ERROR] ",
                            sender_address: %{"from name" <info@my_company.com>},
                            exception_recipients: %w{me@my_company.com},
                            email_format: :html
                        }

The only downside is if you run into an error that quickly repeats. You get TONS of emails! But that’s generally good as you are motivated to fix the issue ASAP.

This gem has helped me immensely in being able to fix errors ASAP!

1 Like