<commit_before>module ExceptionsApp
  class SimpleResponse
    
    def initialize(headers = nil)
      @headers = headers
    end

    def call(env)
      status = env["PATH_INFO"][1..-1]
      @headers ||= {}

      [status, @headers.merge!({"X-Cascade" => "pass"}), []]
    end
  end
end<commit_msg>Modified exceptions_app middleware to load generated static files on exception<commit_after>module ExceptionsApp
  class SimpleResponse
    
    def initialize(headers = nil)
      @headers = headers
    end

    def call(env)
      status = env["PATH_INFO"][1..-1]
      @headers ||= {}
      statics_path = "#{ExceptionsApp.config.statics_path}/#{status}.html"
      p statics_path

      if File.exists?(statics_path)
        render(status, File.read(statics_path))
      else
        [status, @headers.merge!({"X-Cascade" => "pass"}), []]
      end
    end

    private
    
    def render(status, body)
      [status, {'Content-Length' => body.bytesize.to_s}, [body]]
    end
  end
end
{'fraction_non_alphanumeric': 0.13407258064516128, 'fraction_numerical': 0.004032258064516129, 'mean_word_length': 2.6777777777777776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6328802', 'n_tokens_mistral': 321, 'n_tokens_neox': 315, 'n_words': 69}