require 'active_support/concern'

module WatCatcher
  module CatcherOfWats
    extend ActiveSupport::Concern

    included do
      around_filter :catch_wats

      helper_method :wat_user
    end

    def wat_user
      current_user
    end

    def disable_wat_report
      env["wat_report_disabled"] = true
    end

    def report_wat?
      !!(env["wat_report"].present? && !env["wat_report_disabled"])
    end

    def catch_wats(&block)
      block.call
    rescue Exception => e
      user = nil
      begin
        user = wat_user
      rescue;end
      env["wat_report"] = {
        request: request,
        user: user
      }
      raise
    end
  end
end

require 'active_support/concern'

module WatCatcher
  module CatcherOfWats
    extend ActiveSupport::Concern

    included do
      around_action :catch_wats

      helper_method :wat_user
    end

    def wat_user
      current_user
    end

    def disable_wat_report
      request.env["wat_report_disabled"] = true
    end

    def report_wat?
      !!(request.env["wat_report"].present? && !request.env["wat_report_disabled"])
    end

    def catch_wats(&block)
      block.call
    rescue Exception => e
      user = nil
      begin
        user = wat_user
      rescue;end
      request.env["wat_report"] = {
        request: request,
        user: user
      }
      raise
    end
  end
end

Fix Rails 5 deprecation warnings
Fix Rails 5 deprecation warnings

To fix "DEPRECATION WARNING: env is deprecated and will be removed from Rails 5.1" I replaced calls to 'env' with 'request.env' in CatcherOfWats per https://github.com/rails/rails/issues/23294.
To fix "DEPRECATION WARNING: around_filter is deprecated and will be removed in Rails 5.1. Use around_action instead." I replaced 'around_filter' with 'around_action' in CatcherOfWats.
