Sha256: d305d97d57cc3744026445067f8d49d511aab7196f1703af669da19b1ab82b5d
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'runtimeerror_notifier/notifier' module RuntimeerrorNotifier def self.for(*emails) RuntimeerrorNotifier::Notifier.for(*emails) if defined?(::Rails) ::Rails.application.config.middleware.insert 0, RuntimeerrorNotifier::Tracker end renderer_class = if defined?(::ActionDispatch::DebugExceptions) ::ActionDispatch::DebugExceptions elsif defined?(::ActionDispatch::ShowExceptions) ::ActionDispatch::ShowExceptions end if renderer_class renderer_class.class_eval do def render_exception_with_runtimeerror_notifier(env, exception) begin RuntimeerrorNotifier::Notifier.notification(env, exception, {}) rescue Exception # do nothing end render_exception_without_runtimeerror_notifier(env, exception) end alias_method_chain :render_exception, :runtimeerror_notifier end end end class Tracker def initialize(app, options={}) @app, @options = app, options end def call(env) @app.call(env) rescue Exception => ex RuntimeerrorNotifier::Notifier.notification(env, ex, @options) raise ex end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
runtimeerror_notifier-0.0.11 | lib/runtimeerror_notifier.rb |
runtimeerror_notifier-0.0.10 | lib/runtimeerror_notifier.rb |