No commit activity in last 3 years
No release in over 3 years
Rack middleware to send email when exceptions are raised
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 1.5.2
= 10.0.4
= 2.13.0

Runtime

~> 2.2
 Project Readme

rack-exception_notifier Build Status

Rack-exception_notifier is a piece of simple rack middleware that will rescue exceptions and send email using the mail gem. This gem is based on Rack::MailExceptions in rack-contrib.

Usage

First include rack-exception_notifier in your Gemfile:

gem 'rack-exception_notifier'

Next configure the mail gem, by default mail will send email via SMTP to port 25 on localhost. If you would like to change that you can configure the gem according to their documentation.

Then you need to configure rack to use the middleware. Below is an example for sinatra:

enable :raise_errors
use Rack::ExceptionNotifier,
  :to => 'me@example.com',
  :from => 'app@example.com',
  :subject => '[ERROR] %s'

Options

  • :to - destination for email exceptions (required)
  • :from - address to originate email exceptions from (default: running username)
  • :subject - subject line for emails, %s will be interpolated with the exception #to_s (default: [ERROR] %s)
  • :include_body - should the body of the request be included in the email (default: false)