Sha256: 9967529862d64019a41c3668c66e91e7708cc957ef13c5304d5c46e6333d4f9a
Contents?: true
Size: 1006 Bytes
Versions: 1
Compression:
Stored size: 1006 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::RecordNotFound exceptions << ::AbstractController::ActionNotFound if defined? ::AbstractController::ActionNotFound exceptions << ::ActionController::RoutingError if defined? ::ActionController::RoutingError 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 env['exception_notifier.delivered'] = true end raise exception end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exception_notification-2.4.0 | lib/exception_notifier.rb |