<commit_before>require 'json'

module SWF

  # use extend, not include
  module TaskHandler

    def handle runner, task
      handler_class = nil
      handler       = nil
      begin

        handler_class = get_handler_class_or_fail task
        return unless handler_class
        handler = handler_class.new(runner, task)
        handler.call_handle

      rescue => e

        puts "HANDLER #{self} ERROR:"
        begin
          details_json = JSON.pretty_unparse({
            handler_class: handler_class && handler_class.name,
            handler:       handler.inspect,
            error:         e.inspect,
            backtrace:     e.backtrace,<commit_msg>inspect is too long, truncating is unhelpful, need to override inspect to not include gigantic instance variables<commit_after>require 'json'

module SWF

  # use extend, not include
  module TaskHandler

    def handle runner, task
      handler_class = nil
      handler       = nil
      begin

        handler_class = get_handler_class_or_fail task
        return unless handler_class
        handler = handler_class.new(runner, task)
        handler.call_handle

      rescue => e

        puts "HANDLER #{self} ERROR:"
        begin
          details_json = JSON.pretty_unparse({
            handler_class: handler_class && handler_class.name,
            handler:       handler.to_s,
            error:         e.inspect,
            backtrace:     e.backtrace,
{'fraction_non_alphanumeric': 0.061153578874218205, 'fraction_numerical': 0.0, 'mean_word_length': 2.031578947368421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1645468', 'n_tokens_mistral': 391, 'n_tokens_neox': 381, 'n_words': 109}