<commit_before>module Deliver
  class HtmlGenerator
    def run(options, screenshots)
      html_path = self.render(options, screenshots, '.')
      puts "----------------------------------------------------------------------------"
      puts "Verifying the upload via the HTML file can be disabled by either adding"
      puts "`force true` to your Deliverfile or using `deliver --force`"
      puts "----------------------------------------------------------------------------"

      system("open '#{html_path}'")
      okay = agree("Does the Preview on path '#{html_path}' look okay for you? (blue = updated) (y/n)", true)
<commit_msg>Added error handling if the HTML report can't be generated<commit_after>module Deliver
  class HtmlGenerator
    def run(options, screenshots)
      begin
        html_path = self.render(options, screenshots, '.')
      rescue => ex
        Helper.log.error ex.inspect
        Helper.log.error ex.backtrace.join("\n")
        okay = agree("Could not render HTML preview. Do you still want to continue? (y/n)".red, true)
        return if okay
        raise "Could not render HTML page"
      end
      puts "----------------------------------------------------------------------------"
      puts "Verifying the upload via the HTML file can be disabled by either adding"
      puts "`force true` to your Deliverfile or using `deliver --force`"
      puts "----------------------------------------------------------------------------"

      system("open '#{html_path}'")
      okay = agree("Does the Preview on path '#{html_path}' look okay for you? (blue = updated) (y/n)", true)

{'fraction_non_alphanumeric': 0.2745219000616903, 'fraction_numerical': 0.0, 'mean_word_length': 1.5186335403726707, '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': '4486163', 'n_tokens_mistral': 388, 'n_tokens_neox': 390, 'n_words': 146}