No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Allows customization of: * Specify which level of notification you would like with an array of optional styles of notification (email, webhooks) * the sender address of the email * the recipient addresses * the text used to prefix the subject line * the HTTP status codes to notify for * the error classes to send emails for * alternatively, the error classes to not notify for * whether to send error emails or just render without sending anything * the HTTP status and status code that gets rendered with specific errors * the view path to the error page templates * custom errors, with custom error templates * define error layouts at application or controller level, or use the controller's own default layout, or no layout at all * get error notification for errors that occur in the console, using notifiable method * Override the gem's handling and rendering with explicit rescue statements inline. * Hooks into `git blame` output so you can get an idea of who (may) have introduced the bug * Hooks into other website services (e.g. you can send exceptions to to Switchub.com) * Can notify of errors occurring in any class/method using notifiable { method } * Can notify of errors in Rake tasks using NotifiedTask.new instead of task * Works with Hoptoad Notifier, so you can notify via SEN and/or Hoptoad for any particular errors. * Tested with Rails 2.3.x, should work with rails 2.2.x, and is apparently not yet compatible with rails 3.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

< 3, >= 2.0
>= 10.1.1
>= 3.12
>= 1.2.13
>= 2.2.0

Runtime

< 3, >= 0
 Project Readme

Super Exception Notifier

NOTE: This is a legacy gem, for rails 2.x

The Super Exception Notifier (SEN) gem provides a mailer object and a default set of templates for sending email notifications when errors occur in a Rails application, as well as a default set of error page templates to render based on the status code assigned to an error.

Project Super Exception Notifier
gem name super_exception_notifier
license MIT
moldiness Maintainer Status
version Gem Version
dependencies Dependency Status
code quality Code Climate
continuous integration Build Status
test coverage Coverage Status
homepage https://github.com/pboling/exception_notification
documentation http://rdoc.info/github/pboling/exception_notification/frames
author Peter Boling
Spread ♡ⓛⓞⓥⓔ♡ Endorse Me

Summary

The gem is configurable, allowing programmers to customize (settings are per environment or per class):

  • the sender address of the email
  • the recipient addresses
  • text used to prepend and append the subject line
  • the HTTP status codes to send emails for
  • the error classes to send emails for
  • alternatively, the error classes to not send emails for
  • whether to send error emails or just render without sending anything
  • the HTTP status and status code that gets rendered with specific errors
  • the view path to the error page templates
  • custom errors, with custom error templates
  • fine-grained customization of error layouts (or no layout)
  • get error notification for errors that occur in the console, using notifiable method
  • Hooks into git blame output so you can get an idea of who (may) have introduced the bug
  • Hooks into other website services (e.g. you can send exceptions to to Switchub.com)
  • Specify which level of notification you would like with an array of optional styles of notification: [:render, :email, :web_hooks]
  • Can notify of errors occurring in any method in any class in Ruby by wrapping the method call like this: notifiable { method }
  • Can notify of errors in Rake tasks using 'NotifiedTask.new' instead of 'task' when writing tasks
  • Works with Hoptoad Notifier, so you can notify via SEN and/or Hoptoad for any particular errors.
  • Tested with Rails 2.3.x, should work with Rails 2.2.x, and is apparently not compatible with Rails 3 or 4.

The email includes information about the current request, session, and environment, and also gives a backtrace of the exception.

This gem is based on the wonderful exception_notification plugin created by Jamis Buck. I have modified it extensively and merged many of the improvements from a dozen or so other forks. It remains a (mostly) drop in replacement with greatly extended functionality and customization options. I keep it up to date with the work on the core team's branch.

The venerable original is here

The current version of this gem is a git fork of the original and has been updated to include the latest improvements from the original, and many improvements from the other forks on github. I merge them in when I have time, and when the changes fit nicely with the enhancements I have already made.

This fork of Exception Notifier is (or was at some point) in production use on several large websites (top 5000).

Installation as RubyGem

[sudo] gem install super_exception_notifier

More Installation Options are here: http://wiki.github.com/pboling/exception_notification/installation

Configuration as RubyGem in Rails 2.x

(UPGRADE NOTE: The name of the lib changed from SEN version 2.x to 3.x)

config.gem 'super_exception_notifier', :lib => "exception_notification"

More Configuration Options are here: http://wiki.github.com/pboling/exception_notification/configuration

Configuration In Environment (Initializer)

(UPGRADE NOTE: The class invoked here changed from SEN version 2.x to 3.x)

ExceptionNotification::Notifier.configure_exception_notifier do |config|
  config[:app_name]                 = "[MYAPP]"
  config[:sender_address]           = "super.exception.notifier@example.com"
  config[:exception_recipients]     = [] # You need to set at least one recipient if you want to get the notifications
  # In a local environment only use this gem to render, never email
  #defaults to false - meaning by default it sends email.  Setting true will cause it to only render the error pages, and NOT email.
  config[:skip_local_notification]  = true
  # Error Notification will be sent if the HTTP response code for the error matches one of the following error codes
  config[:notify_error_codes]   = %W( 405 500 503 )
  # Error Notification will be sent if the error class matches one of the following error classes
  config[:notify_error_classes] = %W( )
  # What should we do for errors not listed?
  config[:notify_other_errors]  = true
  # If you set this SEN will attempt to use git blame to discover the person who made the last change to the problem code
  config[:git_repo_path]            = nil # ssh://git@blah.example.com/repo/webapp.git
end

More Configuration Options: http://wiki.github.com/pboling/exception_notification/advanced-environment-configuration

Handling Errors in Request Cycle

  1. Include the ExceptionNotification::ExceptionNotifiable mixin in whichever controller you want to generate error emails (typically ApplicationController) as below.

  2. Specify the email recipients in your environment as above. (You may have already done this in the "Configuration in Environment (Initializer)" section above):

  3. Make sure you have your ActionMailer server settings correct if you are using the e-mail features.

  4. That’s it! The defaults take care of the rest.

Code:

class ApplicationController < ActionController::Base
  ############################################################
  # ERROR HANDLING et Foo
  include ExceptionNotification::ExceptionNotifiable
  #Comment out the line below if you want to see the normal rails errors in normal development.
  alias :rescue_action_locally :rescue_action_in_public if Rails.env == 'development'
  #self.error_layout = 'errors'
  self.exception_notifiable_verbose = true #SEN uses logger.info, so won't be verbose in production
  self.exception_notifiable_pass_through = :hoptoad # requires the standard hoptoad gem to be installed, and setup normally
  self.exception_notifiable_silent_exceptions = [Acl9::AccessDenied, MethodDisabled, ActionController::RoutingError ]
  #specific errors can be handled by something else:
  rescue_from 'Acl9::AccessDenied', :with => :access_denied
  # END ERROR HANDLING
  ############################################################
  ...
end

ExceptionNotification::Notifier.configure_exception_notifier do |config|
  config[:exception_recipients] = %w(joe@example.com bill@example.com)
end

http://wiki.github.com/pboling/exception_notification/exceptions-inside-request-cycle

Advanced Configuration

There is a lot more you can configure, and do:

http://wiki.github.com/pboling/exception_notification/

Authors

Peter Boling is the original author of the code, and current maintainer.

Contributors

See the Network View and the CHANGELOG

How you can help!

Take a look at the reek list which is the file called REEK and stat fixing things. Once you complete a change, run the tests:

bundle exec rake test:all

If the tests pass refresh the reek list (need to run in Ruby 1.9.2 or 1.9.3):

bundle exec rake reek > REEK

Follow the instructions for "Contributing" below.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  6. Create new Pull Request

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions.

As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision.

For example:

spec.add_dependency 'super_exception_notifier', '~> 3.0.14'

References

Legal

Bitdeli Badge