<commit_before># Inspired by Bundler.with_friendly_errors

module Henson
  def self.with_friendly_errors
    begin
      yield
    rescue PuppetfileError, ModulefileError => e
      Henson.ui.error   e.message
      Henson.ui.warning e.backtrace.join("\n")
      exit e.exit_code
    rescue PuppetfileNotFound, ModulefileNotFound => e
      Henson.ui.error "Expected to find #{e.message}, but does not exist!"
      exit e.exit_code
    rescue ModuleNotFound => e
      Henson.ui.error "Could not find module: #{e.message}"
    rescue GitInvalidRef => e
      Henson.ui.error e.message<commit_msg>remove duplication from PuppetfileNotFound friendly message<commit_after># Inspired by Bundler.with_friendly_errors

module Henson
  def self.with_friendly_errors
    begin
      yield
    rescue PuppetfileError, ModulefileError => e
      Henson.ui.error   e.message
      Henson.ui.warning e.backtrace.join("\n")
      exit e.exit_code
    rescue PuppetfileNotFound, ModulefileNotFound => e
      Henson.ui.error "#{e.message}, but it does not exist!"
      exit e.exit_code
    rescue ModuleNotFound => e
      Henson.ui.error "Could not find module: #{e.message}"
    rescue GitInvalidRef => e
      Henson.ui.error e.message
{'fraction_non_alphanumeric': 0.08482871125611746, 'fraction_numerical': 0.0, 'mean_word_length': 3.14527027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7562735', 'n_tokens_mistral': 371, 'n_tokens_neox': 377, 'n_words': 100}