Sha256: 4df98a25dd7e5a4449357cfb079c7831fe18d7673fc3fa5dea0e5a4817da912f

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

module ExceptionAlarm
  class Middleware
    def initialize(app)
      @app = app
    end

    def call(env)
      @app.call(env)
    rescue Exception => exception
      if Rails.application.config.exception_alarm.enable && !ignore_exceptions.include?(exception.class.to_s) && Notifier.recipients.present?
        Notifier.alarm(env, exception).deliver
      end

      raise exception
    end

    protected
    def ignore_exceptions
      %w[ActiveRecord::RecordNotFound AbstractController::ActionNotFound ActionController::RoutingError]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception-alarm-0.1.0 lib/exception_alarm/middleware.rb