<commit_before>module StackMaster::TemplateCompilers
  class Yaml

    def self.compile(template_file_path)
      template_body = File.read(template_file_path)
      JSON.dump(YAML.load(template_body))
    end

    StackMaster::TemplateCompiler.register(:yaml, self)
    StackMaster::TemplateCompiler.register(:yml, self)
  end
end<commit_msg>Throw an exception if Psych can't read the template<commit_after>module StackMaster::TemplateCompilers
  class Yaml

    def self.compile(template_file_path)
      template_body = File.read(template_file_path)

      begin
        JSON.dump(YAML.load(template_body))
      rescue Psych::Exception
        raise StackMaster::TemplateCompilers::Yaml::CompileError
      end
    end

    StackMaster::TemplateCompiler.register(:yaml, self)
    StackMaster::TemplateCompiler.register(:yml, self)

    class StackMaster::TemplateCompilers::Yaml::CompileError < RuntimeError; end
  end
end
{'fraction_non_alphanumeric': 0.08747300215982722, 'fraction_numerical': 0.0, 'mean_word_length': 4.5843373493975905, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '7139628', 'n_tokens_mistral': 270, 'n_tokens_neox': 257, 'n_words': 49}