<commit_before>module Airbrake
  module Rails
    module Middleware
      module ExceptionsCatcher
        def self.included(base)
          base.send(:alias_method_chain,:render_exception,:airbrake)
        end

        def skip_user_agent?(env)
          user_agent = env["HTTP_USER_AGENT"]
          ::Airbrake.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
        rescue
          false
        end

        def render_exception_with_airbrake(env,exception)
          controller = env['action_controller.instance']
          env['airbrake.error_id'] = Airbrake.
            notify_or_ignore(exception,
                   controller.airbrake_request_data) unless skip_user_agent?(env)<commit_msg>Fix Airbrake so it actually reports data.<commit_after>module Airbrake
  module Rails
    module Middleware
      module ExceptionsCatcher
        def self.included(base)
          base.send(:alias_method_chain,:render_exception,:airbrake)
        end

        def skip_user_agent?(env)
          user_agent = env["HTTP_USER_AGENT"]
          ::Airbrake.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
        rescue
          false
        end

        def render_exception_with_airbrake(env,exception)
          controller = env['action_controller.instance']
          env['airbrake.error_id'] = Airbrake.
            notify_or_ignore(exception,
                   controller.try(:airbrake_request_data) || {:rack_env => env}) unless skip_user_agent?(env)
{'fraction_non_alphanumeric': 0.08565737051792828, 'fraction_numerical': 0.0, 'mean_word_length': 2.640096618357488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5995026', 'n_tokens_mistral': 443, 'n_tokens_neox': 433, 'n_words': 73}