Sha256: 50369cd3abc85f8d3a636bed90a98adeeeef38c6f94101c77dc298ba5df42de1
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
require 'action_dispatch' require 'exception_notifier/notifier' class ExceptionNotifier def self.default_ignore_exceptions [].tap do |exceptions| exceptions << ActiveRecord::RecordNotFound if defined? ActiveRecord exceptions << AbstractController::ActionNotFound if defined? AbstractController exceptions << ActionController::RoutingError if defined? ActionController end end def initialize(app, options = {}) @app, @options = app, options @options[:ignore_exceptions] ||= self.class.default_ignore_exceptions end def call(env) @app.call(env) rescue Exception => exception options = (env['exception_notifier.options'] ||= {}) options.reverse_merge!(@options) unless Array.wrap(options[:ignore_exceptions]).include?(exception.class) Notifier.exception_notification(env, exception).deliver end raise exception end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exception_notifier-1.0.0 | lib/exception_notifier.rb |